AggregateModel
An aggregate type compiled into tables: what each command type runs and how it is named, how each event type evolves the state, and how each event type is named in the log. Built once, read on every command; the hot path only looks things up.
State is mutable by default: evolve may change S in place and return it. The kernel never lets a changed instance outlive a failure: it evolves a state freshly loaded for the attempt and drops it if the attempt does not commit.
stateType is the class of S: snapshots are read back as it, and its schema fingerprint tells whether a snapshot still fits it (EventCodec.stateSchemaFingerprint).
Every model handles the lifecycle commands of lifecycle (all of them unless it says otherwise) without user code: the kernel decides them, under their system names (Lifecycle). A model that declares a decide function for one overrides the kernel's, to add domain rules to it: it decides that command's own lifecycle event beside the aggregate's own events, NoOp or a rejection, and another lifecycle event fails the command (LifecycleOverride). The compiler never generates one, since an annotated model's decide function takes no lifecycle command: its own command produces the lifecycle event beside its events instead, which the kernel evolves as it evolves the lifecycle commands' events. The lifecycle events are always known, so a log written while a command was enabled still reads; they leave the state as it is unless the model declares an evolve function for them. Only the lifecycle types may take a name in the system namespace.
ownership is who the aggregate belongs to besides its tenant: an Ownership.TENANT aggregate records no owner and checks no command's owner (the kernel keeps only Ownership.scopeOf of a command's scope), so it has no owner to transfer: it never handles TransferOwner.
idSource is where the aggregate's id comes from: an AggregateIdSource.OWNER aggregate's id is its owner's, so the kernel records its id as its owner, refuses a command whose caller has another owner, and never transfers its owner (TransferOwner is left out, and a decide function for it is refused). It belongs to its owner (Ownership.OWNER).
stateRevision is the revision of the state's structure its snapshots are written at: a snapshot of another revision is not read back, and the service rebuilds the stored ones in place when it is raised.
retiredEvents are the stored names of events the aggregate no longer has (9.x DroppedEvent): the class is gone, but the log still holds records under the name. Such a record is skipped, never decoded: replaying the stream applies nothing for it, though the stream still counts as a version, and a subscription passes over it. A name that is neither an event's nor retired still fails to read. A retired name is not blank, is listed once, and is none of the model's event or command names, current or former. Every model also retires the lifecycle events Wow no longer has (KernelLifecycle.RETIRED_EVENTS, such as wow.lifecycle.TagsApplied), which retiredEvents does not list: a log a released version wrote still loads.
aggregateIds reads, by command class, the id of the aggregate a command acts on from its body (@AggregateId): such a command's request need not name its aggregate (aggregateIdOf). A command decided here takes one, not an aggregate whose id is its owner's.
access are the aggregate's access attributes (@Access), each with the function that reads it from the state: the facts its access policies compare with a caller's claims, derived from the state alone (accessOf) by pure, cheap functions, since they run on each commit. Their names differ even ignoring case, and none is a built-in attribute's (AccessAttribute.BUILT_IN).
Constructors
Properties
The aggregate's access attributes (@Access) in declaration order; the built-in ones are not among them.
The names of accessAttributes: the keys of accessOf.
The command types this model decides, each under its name and former names: those of its decide functions, then the lifecycle commands the kernel decides for it (lifecycleCommands) under their system names.
The lifecycle commands this model handles, by the kernel or by its own decide functions.
The commands mounted under this aggregate's routes that it does not decide: admission finds them by name, and a transformer turns each into a command that is decided.
Whether an evolve function reads the commit its event belongs to: the kernel then gives each event its commit (evolve), as the log records it, whether it evolves after a decision or replays the log.
The stored names of the events this aggregate retired: their records are skipped.
Functions
The values of the aggregate's access attributes in state, by name, in declaration order: a single attribute's value or null, a multiple one's values as a set, copied, so a mutable state evolving further does not change them. Empty when it declares none. A value that is not of its attribute's type fails, naming the attribute.
The after hooks that run for commandType, in declaration order.
The id of the aggregate command acts on, as its body holds it (@AggregateId): null when its class holds none there (idFromBody), or when it leaves it null (a creation, which then gets one).
The name of commandClass, a command this aggregate decides.
The decide function for commandType, or null when the aggregate does not handle it.
Applies event to state. commit is the commit the event belongs to, which an evolve function may read (readsCommits): the kernel gives it, from the log or from the decision being committed.
The name of commandClass, or null when it is no command of this aggregate.
The command type named name (or formerly named so), or null when this aggregate has none: how a command that arrives in its wire form (a forwarded one) finds the class its body is read as.
The event type named name (or formerly named so) in the log, or null when this aggregate has none.
The command mounted under this aggregate named name (or formerly named so), or null when none is.
Whether a command of commandType holds the id of its aggregate in its body (@AggregateId).
The state of an aggregate that has no event yet.
Whether name is the stored name of an event this aggregate retired (retiredEvents), or of a lifecycle event Wow no longer has (KernelLifecycle.RETIRED_EVENTS).