Package-level declarations

Types

Link copied to clipboard
class MemoryQueries @InternalWowApi constructor(manifest: Manifest, stateTypes: Map<AggregateType, Class<*>> = emptyMap(), access: List<AccessPolicy<*>> = emptyList(), filters: List<QueryFilter> = emptyList()) : TenantQueryApi

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.

Functions

Link copied to clipboard
fun ProcessorSpec.givenSnapshots(type: AggregateType, vararg states: Pair<String, Any>, tenantId: String = Caller.DEFAULT_TENANT): MemoryQueries

Serves the handlers' reads from a memoryQueries holding states, each an aggregate id to its state, as snapshots of type in tenantId. It replaces the queries given before: a spec that reads several types gives one memoryQueries.

fun <S : Any> ProcessorSpec.givenSnapshots(model: AggregateModel<S>, id: String, vararg events: Any, tenantId: String = Caller.DEFAULT_TENANT): MemoryQueries

Serves the handlers' reads from a memoryQueries holding the snapshot of the aggregate id of model in tenantId, in the state events leave it in (MemoryQueries.snapshot). It replaces the queries given before: a spec that reads several aggregates gives one memoryQueries.

Link copied to clipboard
fun memoryQueries(dependencies: Dependencies = Dependencies.NONE, access: List<AccessPolicy<*>> = emptyList(), filters: List<QueryFilter> = emptyList(), block: MemoryQueries.() -> Unit = {}): MemoryQueries

The read side of the modules on the class path (MemoryQueries.of), with the snapshots block gives: memoryQueries { snapshots(Stock.TYPE, "mug" to Stock(7)) }.