SnapshotRecord

class SnapshotRecord @InternalWowApi constructor(val ref: AggregateRef, val version: Int, val schemaFingerprint: String, val state: String, val scope: Scope = Scope.NONE, val deleted: Boolean = false, val firstEventTime: Long, val lastEventTime: Long, val access: Map<String, Any?> = emptyMap(), val operator: Operator? = null, val firstOperator: Operator? = null, val schedules: Map<String, ScheduleRule> = emptyMap(), val stateRevision: Int = 1)

An aggregate's latest committed state as the snapshot store keeps it: a cache derived from the log, never a fact.

  • version is the version of the last event stream folded into state;

  • schemaFingerprint identifies the state's schema: a reader whose fingerprint differs discards the snapshot and rebuilds the state from the log;

  • stateRevision is the revision of the state's structure the snapshot was written at (@AggregateRoot(stateRevision)): a reader of another revision does not read it back, and a store never lets a snapshot of a lower revision replace one of a higher revision;

  • state is the serialized state, a JSON document;

  • scope is the aggregate's owner and space, the scope of the last event stream folded, and access its declared access attributes after it, in their stored form (me.ahoo.wow.spi.access.AccessValues), the built-in owner and space being scope's; the query side filters on the same fields;

  • deleted marks an aggregate that is deleted; its snapshot stays, so it can be queried and restored;

  • firstEventTime and lastEventTime are the commit times (epoch milliseconds) of its first and last streams;

  • operator and firstOperator are the operators of its last stream and of its first, the one that created it; each null when that stream's caller was anonymous. Both are queryable system fields.

  • schedules are the schedules the aggregate keeps, each rule by its key: those its streams set (wow.ScheduleSet) and did not cancel (wow.ScheduleCancelled), fired or not; a deleted aggregate keeps none.

Fields may be added: construct one with of; the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(ref: AggregateRef, version: Int, schemaFingerprint: String, state: String, scope: Scope = Scope.NONE, deleted: Boolean = false, firstEventTime: Long, lastEventTime: Long, access: Map<String, Any?> = emptyMap(), operator: Operator? = null, firstOperator: Operator? = null, schedules: Map<String, ScheduleRule> = emptyMap(), stateRevision: Int = 1)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copyWith(ref: AggregateRef = this.ref, version: Int = this.version, schemaFingerprint: String = this.schemaFingerprint, state: String = this.state, scope: Scope = this.scope, deleted: Boolean = this.deleted, firstEventTime: Long = this.firstEventTime, lastEventTime: Long = this.lastEventTime, access: Map<String, Any?> = this.access, operator: Operator? = this.operator, firstOperator: Operator? = this.firstOperator, schedules: Map<String, ScheduleRule> = this.schedules, stateRevision: Int = this.stateRevision): SnapshotRecord

This SnapshotRecord with the given fields replaced: Wow's own copy, left out of the ABI.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String