1 | <?php |
||
12 | class LogEngine implements EngineInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $fname; |
||
18 | |||
19 | /** |
||
20 | * @var resource Log stream |
||
21 | */ |
||
22 | private $stream; |
||
23 | |||
24 | /** |
||
25 | * @var DecoderInterface Decoder used to encode and deconde content |
||
26 | */ |
||
27 | private $decoder; |
||
28 | |||
29 | /** |
||
30 | * @var array List of non-commited documents |
||
31 | */ |
||
32 | private $newDocs = []; |
||
33 | |||
34 | public function __construct(string $fname, DecoderInterface $decoder = null) |
||
40 | |||
41 | public function getId(): string |
||
45 | |||
46 | public function getIterator(): \Generator |
||
54 | |||
55 | /** |
||
56 | * @throws LogicException If id is specified |
||
57 | */ |
||
58 | public function write(string $id, array $doc): string |
||
67 | |||
68 | public function inTransaction(): bool |
||
72 | |||
73 | public function reset() |
||
77 | |||
78 | public function commit() |
||
89 | |||
90 | /** |
||
91 | * @throws LogicException Not supported by LogEngine |
||
92 | */ |
||
93 | public function has(string $id): bool |
||
97 | |||
98 | /** |
||
99 | * @throws LogicException Not supported by LogEngine |
||
100 | */ |
||
101 | public function read(string $id): array |
||
105 | |||
106 | /** |
||
107 | * @throws LogicException Not supported by LogEngine |
||
108 | */ |
||
109 | public function delete(string $id): bool |
||
113 | |||
114 | /** |
||
115 | * @throws LogicException Not supported by LogEngine |
||
116 | */ |
||
117 | public function clear() |
||
121 | } |
||
122 |