1 | <?php |
||
11 | class InMemoryEventStore extends AbstractEventStore |
||
12 | { |
||
13 | /** |
||
14 | * @var IdentifiedEventStream[] |
||
15 | */ |
||
16 | private $streams; |
||
17 | |||
18 | /** |
||
19 | * @param SerializerInterface $serializer |
||
20 | * @param EventUpgraderInterface $eventUpgrader |
||
21 | * @param IdentifiedEventStream[] $streams |
||
22 | */ |
||
23 | 35 | public function __construct( |
|
31 | |||
32 | /** |
||
33 | * @param string $streamId |
||
34 | * @param StoredEvent[] $storedEvents |
||
35 | * @param int $expectedVersion |
||
36 | */ |
||
37 | 14 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
45 | |||
46 | /** |
||
47 | * @param string $streamId |
||
48 | * @return EventStreamInterface |
||
49 | */ |
||
50 | 18 | public function readFullStream($streamId) |
|
58 | |||
59 | /** |
||
60 | * @param string $streamId |
||
61 | * @param int $start |
||
62 | * @param int $count |
||
63 | * @return EventStreamInterface |
||
64 | */ |
||
65 | 6 | public function readStreamEvents($streamId, $start = 1, $count = null) |
|
75 | |||
76 | /** |
||
77 | * @return EventStreamInterface[] |
||
78 | */ |
||
79 | 2 | public function readAllStreams() |
|
87 | |||
88 | /** |
||
89 | * @return EventStreamInterface |
||
90 | */ |
||
91 | 1 | public function readAllEvents() |
|
100 | |||
101 | /** |
||
102 | * @param string $streamId |
||
103 | * @return int |
||
104 | */ |
||
105 | 4 | protected function streamVersion($streamId) |
|
110 | |||
111 | /** |
||
112 | * @param string $type |
||
113 | * @param Version $version |
||
114 | * @return EventStreamInterface |
||
115 | */ |
||
116 | 1 | protected function readStoredEventsOfTypeAndVersion($type, $version) |
|
129 | |||
130 | /** |
||
131 | * @param string $streamId |
||
132 | * @return bool |
||
133 | */ |
||
134 | 34 | protected function streamExists($streamId) |
|
138 | |||
139 | /** |
||
140 | * @param string $streamId |
||
141 | * @param \DateTimeImmutable $datetime |
||
142 | * @return int |
||
143 | * @throws EventStreamDoesNotExistException |
||
144 | */ |
||
145 | 4 | public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime) |
|
157 | } |
||
158 |