FileEventStore
Append-only JSONL log of {@see Event}s: one JSON object per line, one line per event, never rewritten or truncated. Zero DB — a flat file is the entire durability story. `nextSeq()` and `replay()` both derive their answer from the file itself rather than from an in-memory counter, on purpose: a fresh `FileEventStore` pointed at the same path — a different process, a different request — must agree with every other instance about both "what happened" and "what comes next", and the file is the only thing every instance shares.
FileEventStore::__construct()
public function __construct(string $path):Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | path to the JSONL log file; its directory is created on first append if missing |
FileEventStore::append()
public function append(Milpa\EventStore\Event $event): voidAppends `$event` as one JSON line, under an exclusive lock so concurrent appenders cannot interleave partial lines.
Parameters
| Name | Type | Description |
|---|---|---|
| $event | Milpa\EventStore\Event |
FileEventStore::replay()
public function replay(string $streamId): arrayAll events belonging to `$streamId`, in ascending `seq` order.
Parameters
| Name | Type | Description |
|---|---|---|
| $streamId | string |
FileEventStore::nextSeq()
public function nextSeq(): intThe next `seq` to assign, one past the highest `seq` currently in the store (across every stream) — `1` for an empty or missing log.
FileEventStore::streams()
public function streams(): arrayEvery distinct stream id present in the store, in the order each first appears (ascending `seq` of its first event).