SharedStateReader
Reads the state after a committed stream for one state consumer, the reader of the context's views, in this order:
the view taken at the stream's version (SharedStates.get): what the executor recorded as it committed (or expected just before, when the log hands this node's commit over first), or what another reader rebuilt;
otherwise the stream in hand evolved from the state right before it, reading no store: the view at the previous version, such as the one this reader handled last, or the initial state for the aggregate's first stream;
otherwise the state rebuilt from the nearest base before the version: the latest view before it (SharedStates.floor, such as the one this reader rebuilt for the aggregate's previous commit) or the aggregate's snapshot in snapshots, whichever is later, evolved with the log's tail up to the version (Kernel.stateAt);
without either (no view, and no snapshot or one already past the version), the log replayed up to the version.
A rebuild (3. and 4.) runs one an aggregate at a time across the readers of the views, under the node's ReplayGate (SharedStates.rebuild): a reader that misses an aggregate another reader is rebuilding waits for that rebuild, then reads again, so the view it left, at this version or the one before, is evolved rather than the log replayed again. A gate that refuses the replay fails the read as a busy store, which the subscription retries as backpressure.
A rebuilt state is put back into the views, so the next commit of the aggregate, for this reader or another behind it, evolves it with one stream rather than replaying the log again: a subscription behind the snapshot replays its aggregate once, not on every commit. Each read passes the version, so the views this reader no longer needs can be evicted.
codec must be the kernel's, so a view decodes as it was encoded. It runs inside the subscription's retries: a state that cannot be read is retried, then parks the aggregate like a failing handler.
Constructors
Properties
Functions
The model of type, whose events and state this reader decodes.
This reader is done with ref up to version (SharedStates.pass).
The state after stream.