Package-level declarations

Types

Link copied to clipboard
class CommittedEvent @InternalWowApi constructor(val name: String, val revision: Int, val body: Any)

One event of an EventStream: its name and revision as the model reads it now (upgraded) and its body, masked as the Manifest declares: an instance of the model's event class, or a Map of an event the reader has no class for. The commit a sourcing function reads holds the events as the model's classes, unmasked.

Link copied to clipboard
class DatasetName @InternalWowApi constructor(val context: String, val name: String)

The name of a dataset: the bounded context that publishes it and its name there, context.dataset on the wire. A dataset is a read model of its own, not an aggregate, so it has a name type of its own.

Link copied to clipboard

The events queries of an aggregate type: one row per commit, an EventStream.

Link copied to clipboard
class EventStream @InternalWowApi constructor(val ref: AggregateRef, val version: Int, val commitTime: Long, val commandId: String, val requestId: String, val commandType: String, val scope: Scope, val operator: Operator?, val events: List<CommittedEvent>)

The commit of ref at version, at commitTime (epoch milliseconds), of the command commandId of type commandType sent with requestId in the name of operator, in the aggregate's scope, and its events in order: one row of an events query, and the commit a sourcing function reads beside its event (me.ahoo.wow.api.annotation.OnSourcing), as the log records it.

Link copied to clipboard
class MinVersionNotReachedException(val ref: AggregateRef, val minVersion: Int, val version: Int) : RuntimeException

A state read that asked for at least minVersion of ref (read your writes) while the aggregate stayed at version (0 when it has no commit) through the read's wait: the command whose version was asked for has not committed yet. The HTTP state route answers it 409 CODE with the version, and Retry-After.

Link copied to clipboard
interface ModelQueries<R : Any> : RowQueries<R>

The queries of an aggregate's model, its rows typed, with the same queries returning the rows as stored.

Link copied to clipboard

The node's read API, its own read side in process: a caller's queries (of) and trusted code's (trusted), which runs on the node and nowhere else (a job, a projection's rebuild, a route of the service's own); a peer reads for a caller, so a client's QueryApi has no trusted queries.

Link copied to clipboard
class Positioned<out R : Any> @InternalWowApi constructor(val row: R, val position: String?)

A row of a resumable stream and its position: the opaque token of its place in the stream's order, after which the same query streams on. null in a stream that cannot be resumed.

Link copied to clipboard
interface Queries : QueryModels

The queries of one caller (QueryApi.of), or of a commit's tenant (SubscriptionQueries): they read in a tenant, so a state is read by its aggregate id too (TenantSnapshotQueries).

Link copied to clipboard
interface QueryApi

The typed read API: the snapshots, the events and the datasets of the read side, queried as someone. There is no entry that names nobody: of a caller reads within that caller's scope, under the same admission, visibility, bulkhead and budget as the public port's queries. A client's reads another service's over HTTP this way alone; the node's own, a NodeQueryApi, also reads as trusted code.

Link copied to clipboard
interface QueryModels

The query models one caller (Queries) or trusted code (TrustedQueries) reads. A row of a type the reader names no class of, a state read by its type or an event no class of the model has, is an ObjectNode, in process and over HTTP alike.

Link copied to clipboard
interface RowQueries<R : Any>

The query operations of one model, each row decoded as R. A row a policy hides is never returned; a field the schema masks is masked as on the public port.

Link copied to clipboard
class Snapshot<out S : Any> @InternalWowApi constructor(val ref: AggregateRef, val version: Int, val scope: Scope, val access: Map<String, Any?>, val deleted: Boolean, val operator: Operator?, val firstEventTime: Long, val lastEventTime: Long, val state: S, val firstOperator: Operator? = null, val schedules: Map<String, ScheduleRule> = emptyMap())

An aggregate's latest committed state as a snapshot query and a state read answer it: the aggregate ref at version, its scope (owner and space), its access attributes (@Access, by name: a single one's value or null, a multiple one's values as a list), whether it is deleted, the operator of its last commit and the firstOperator of its first, the one that created it (each null for an anonymous caller), the times of its first and last events (epoch milliseconds), the schedules it keeps, each rule by its key, and its state, masked as the schema says.

Link copied to clipboard

The snapshot queries of an aggregate type: one row per aggregate, a Snapshot of its state S, and the latest state of an aggregate by its ref. A typed row reads the whole record: a query with a projection is refused, run it through dynamic.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class StateView(val aggregate: String)

Marks a view of an aggregate's state: a class the state decodes into, which another context reads that state as. An api module's generated <State>View carries it, naming the aggregate whose state it views by its qualified name, context.aggregate; so Queries.snapshots of the view finds the aggregate type, in process and over HTTP alike. A view is of one aggregate.

Link copied to clipboard

The queries of a subscription handler (me.ahoo.wow.api.subscribe.SubscriptionContext.queries): the whole tenant of the commit it handles, as trusted code pinned to that tenant (no owner, space or caller attribute restricts them, and no policy that reads the caller hides a row), under the in-process budget. Another tenant's rows only through an explicit trusted.

Link copied to clipboard

A NodeQueryApi that builds the reads of a subscription handler itself (tenant), which the node asks of every QueryApi it hands its handlers: a provider's side of the read API, not an entry point of an application, which reads as a caller (of) or as trusted code (trusted).

Link copied to clipboard

The snapshot queries of a tenant's reader (Queries): a state is read by its aggregate id too, in the tenant the queries read (the caller's, or the commit's).

Link copied to clipboard

The queries of trusted code (NodeQueryApi.trusted): no tenant restricts them, so a state is read by its ref alone (SnapshotQueries). unbounded lifts the in-process budget for a job that must read everything.

Functions

Link copied to clipboard
inline fun <reified G : Any> RowQueries<*>.aggregate(query: AggregationQuery): Flow<G>

The groups of query decoded as G; see RowQueries.aggregate.

Link copied to clipboard

The rows of the dataset name decoded as R; see QueryModels.datasets.

Link copied to clipboard
inline fun <reified T : Any> ModelQueries<*>.dynamic(): RowQueries<T>

These queries with each row decoded as T; see ModelQueries.dynamic.

Link copied to clipboard
inline fun <reified S : Any> Queries.snapshots(): TenantSnapshotQueries<S>

The snapshots of the aggregate whose state is S, in the queries' tenant; see Queries.snapshots.

inline fun <reified S : Any> TrustedQueries.snapshots(): SnapshotQueries<S>

The snapshots of the aggregate whose state is S, as trusted code; see QueryModels.snapshots.