StateReads

The state point reads of the node's aggregates: the public port's GET /{context}/{aggregate}/{id}/state reads latest, ?version= and ?at= read at, GET …/{id}/state/trace reads trace. They read what is committed, for no caller: an entry checks the caller's scope against the state's and admits and masks the state as the snapshot queries do (me.ahoo.wow.query.state.StateVisibility).

Inheritors

Types

Link copied to clipboard

Functions

Link copied to clipboard
abstract suspend fun at(ref: AggregateRef, instant: Instant): Snapshot<JsonNode>?

The committed state of ref as of instant: after the last commit at or before it by commit time; null when none had committed by then. Replayed as at a version is.

abstract suspend fun at(ref: AggregateRef, version: Int): Snapshot<JsonNode>?

The committed state of ref at version, or null when the log does not hold that version. Its replay runs under the node's ReplayGate and folds a bounded number of streams: past the bound, it throws StateReplayLimitException.

Link copied to clipboard
abstract suspend fun latest(ref: AggregateRef): Snapshot<JsonNode>?

The latest state of ref: the one the read model holds, else, before its first snapshot is written (or with its snapshots off), the state its log holds; null when no commit of ref is known. A read that replays the log runs under the node's ReplayGate (its log store's query bulkhead).

abstract suspend fun latest(ref: AggregateRef, minVersion: Int): Snapshot<JsonNode>?

The latest state of ref at version minVersion or later (read your writes): its snapshot when it has reached minVersion, else its log replayed from the snapshot to its head, as at a version is; and while the log too is below minVersion (the command has not committed yet), read again until a bounded wait runs out.

Link copied to clipboard
abstract suspend fun trace(ref: AggregateRef, fromVersion: Int, toVersion: Int, limit: Int): List<CommitView>

The commits of ref from version fromVersion up to toVersion, at most limit, in version order, each with its events and the state after it; empty when the log holds none of those versions. Replayed as at a version is, the state before fromVersion included.