1 | <?php |
||
10 | final class FileEventStore implements EventStore |
||
11 | { |
||
12 | private $dataPath; |
||
13 | |||
14 | public function __construct($dataPath) |
||
18 | |||
19 | /** |
||
20 | * Serialize given events and save them do disk. |
||
21 | * Actually, each event is a new line inside a single file for each aggregate |
||
22 | * |
||
23 | * @param \Domain\Eventing\UncommittedEvents $events |
||
24 | * @return void |
||
25 | */ |
||
26 | public function commit(UncommittedEvents $events) |
||
41 | |||
42 | /** |
||
43 | * Open the aggregate file and read lines from $min to $max, unserialize and return |
||
44 | * immutable event stream as "committed events". |
||
45 | * |
||
46 | * @param \Domain\Identity\Identity $id |
||
47 | * @param integer $offset |
||
48 | * @param integer $max |
||
49 | * @return \Domain\Eventing\CommittedEvents |
||
50 | */ |
||
51 | public function getAggregateHistoryFor(Identity $id, $offset = 0, $max = null) |
||
76 | } |
||
77 |