MemoryQueries
A real read side for a processor spec (ProcessorSpec.givenQueries): the query engine of the Manifest the modules on the class path declare, over snapshots held in memory. A handler's reads run as on a node: the filters, the scope and tenant policies and the budgets apply, and the snapshots decode as the aggregates' state classes.
The Manifest and the state classes come from the modules' binding index (ModelProvider): each module's fragment, merged, and each state class the Manifest names by its binary name (#/$defs/<binary name>, as the compiler writes it), so a state is read by its class whatever the model takes, the node's QueryApi or any other service. A state a hand-written fragment names otherwise comes from the module's models, built with the dependencies given, else from the states given to it (snapshot).
sagaSpec(handlers) {
givenQueries(memoryQueries { snapshots(Stock.TYPE, "mug" to Stock(7), "cup" to Stock(0)) })
whenEvent(...) { ... }
}Only the snapshot queries are served, with the state reads by id of the snapshots given; the events and the datasets are not. A spec builds one with memoryQueries or of.
Constructors
Functions
Holds the state events leave the aggregate id of model in as its latest snapshot, in tenantId, at the version of its last event, one commit per event: model replays them as ProcessorSpec.givenAggregate does, so the state is the one the aggregate's own sourcing builds. An event model has no sourcing function for is refused. owner and deleted are the snapshot's, as snapshot of a state takes them; its access attributes are those model reads from the state.
Holds state as the latest snapshot of the aggregate id of type in tenantId: what the snapshot queries and a state read by id of it return. owner is its scope, the owner and space the scope policies check, and access its declared access attributes by name (a single one's value, a multiple one's values).
A handler's queries of tenantId, pinned to it as on a node (InProcessQueryApi.tenant).