Package-level declarations

Types

Link copied to clipboard
data class CommitView(val version: Int, val commitTime: Long, val commandId: String, val requestId: String, val commandType: String, val events: List<EventView>, val scope: Scope, val deleted: Boolean, val access: Map<String, Any?>, val state: JsonNode, val operator: Operator? = null)

One commit of a trace: the stream at version, committed at commitTime (epoch milliseconds) for the command commandId of type commandType sent with requestId in the name of operator, its events, and the aggregate after it: its scope, deleted mark, declared access attributes and state.

Link copied to clipboard
data class EventView(val name: String, val revision: Int, val body: JsonNode)

An event of a commit: its name and body as the model reads it now, upgraded to revision.

Link copied to clipboard
class KernelStateReads(registry: ModelRegistry, contexts: Map<String, KernelStateReads.ContextReads>, gate: ReplayGate = ReplayGate.OPEN, maxReplay: Int = DEFAULT_MAX_REPLAY, minVersionWait: Duration = DEFAULT_MIN_VERSION_WAIT) : StateReads

StateReads of the contexts a node serves: the latest state is the snapshot (SnapshotStore, the default read model), else, while an aggregate has none, its log replayed by the context's Kernel from version 1 (Kernel.stateAt, as the write side loads a state without a snapshot) under gate; a state at a version or a time, and a trace, are the log replayed (Kernel.stateAt, Kernel.trace) from the snapshot when it comes before what is asked, else from version 1, under gate too. Every replay but committed's folds the log as it reads it and at most maxReplay streams of it: a read that needs more is refused with StateReplayLimitException.

Link copied to clipboard

How a node's state reads that replay the log run: KernelStateReads replays an aggregate's latest state without a snapshot, a state at a version or a time, and a trace inside replay, which the host runs under the query bulkhead of the aggregate's log store, so that point reads cannot take every connection the store's appends draw from. Background replays (the access walk's) also ask whether that store's writes are pressed (pressed), and give way while they are.

Link copied to clipboard
class SerializedState(val version: Int, val state: String, val scope: Scope = Scope.NONE, val deleted: Boolean = false, val schedules: Map<String, ScheduleRule> = emptyMap(), val first: FirstCommit? = null)

The state of an aggregate after its stream version: its state as the kernel's codec serialized it, the scope of the stream, whether it is deleted and its schedules, as the kernel committed them. A view is serialized once and decoded afresh by each reader, so no reader sees another's changes nor the live instance. This is the runtime's form, the text a snapshot stores; what a sink publishes is the :spi me.ahoo.wow.spi.state.PublishedState, a JSON tree with its schema's fingerprint, which me.ahoo.wow.runtime.sink.SinkSubscription maps this one to.

Link copied to clipboard
class SharedStateOptions @InternalWowApi constructor(val capacity: Int = DEFAULT_CAPACITY, val maxAge: Duration = DEFAULT_MAX_AGE, val maxBytes: Long = DEFAULT_MAX_BYTES)

The bounds of a context's SharedStates: at most capacity views, holding at most maxBytes of serialized state (a few aggregates with states of hundreds of kilobytes would otherwise take gigabytes within the count), none older than maxAge. The host configures them (wow.shared-states.*).

Link copied to clipboard
class SharedStateReader(val reader: String, models: Collection<AggregateModel<*>>, kernel: Kernel, val codec: EventCodec, views: SharedStates, snapshots: SnapshotStore? = null)

Reads the state after a committed stream for one state consumer, the reader of the context's views, in this order:

Link copied to clipboard
class SharedStates(codec: EventCodec, readers: Map<String, Set<AggregateType>>, options: SharedStateOptions = SharedStateOptions(), timeSource: TimeSource = TimeSource.Monotonic, val gate: ReplayGate = ReplayGate.OPEN)

The shared states of one bounded context, shared by every state consumer of it: the snapshot subscription, the subscriptions of annotated processors, and later the sinks. Each of them is a named readers entry with the aggregate types it reads.

Link copied to clipboard

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).

Link copied to clipboard

A state read of ref that would replay more than limit streams of its log: refused before the stream past limit is folded. The state exists; it is only too far from the snapshot, or from version 1, to be replayed for a point read, which an entry answers as the client's request asking too much.