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 caughtUp(ref: AggregateRef): Snapshot<JsonNode>?

The latest state of ref caught up with its log once, without waiting: the log replayed to its head under the node's ReplayGate, from its snapshot when the snapshot fits the model and from version 1 when it does not (of another state revision or schema, not decodable, or past the log), at most as many streams as at a version replays (past them it throws StateReplayLimitException). Null when ref has no snapshot to catch up from (its latest state is then its log already, latest), when its log holds none of its streams, or when no commit of it is known.

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 to its head as caughtUp replays it, and from version 1 without a snapshot; and while the log too is below minVersion (the command has not committed yet), read again until a bounded wait runs out. It answers the state it read last: one below minVersion when the wait ran out, which the entry checks its caller on before it says so; null when no commit of ref is known.

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.