1 | <?php |
||
12 | class LogEngine implements EngineInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var resource Log stream |
||
16 | */ |
||
17 | private $stream; |
||
18 | |||
19 | /** |
||
20 | * @var DecoderInterface Decoder used to encode and deconde content |
||
21 | */ |
||
22 | private $decoder; |
||
23 | |||
24 | /** |
||
25 | * @var array List of non-commited documents |
||
26 | */ |
||
27 | private $newDocs = []; |
||
28 | |||
29 | public function __construct(string $fname, DecoderInterface $decoder = null) |
||
34 | |||
35 | public function getIterator(): \Generator |
||
43 | |||
44 | /** |
||
45 | * @throws LogicException If id is specified |
||
46 | */ |
||
47 | public function write(string $id, array $doc): string |
||
56 | |||
57 | public function inTransaction(): bool |
||
61 | |||
62 | public function reset() |
||
66 | |||
67 | public function commit() |
||
78 | |||
79 | /** |
||
80 | * @throws LogicException Not supported by LogEngine |
||
81 | */ |
||
82 | public function has(string $id): bool |
||
86 | |||
87 | /** |
||
88 | * @throws LogicException Not supported by LogEngine |
||
89 | */ |
||
90 | public function read(string $id): array |
||
94 | |||
95 | /** |
||
96 | * @throws LogicException Not supported by LogEngine |
||
97 | */ |
||
98 | public function delete(string $id): bool |
||
102 | |||
103 | /** |
||
104 | * @throws LogicException Not supported by LogEngine |
||
105 | */ |
||
106 | public function clear() |
||
110 | } |
||
111 |