InMemoryQueryStorage

class InMemoryQueryStorage(delay: Duration = Duration.ZERO) : QueryBindings<AggregateType>

The in-memory reference query storage: the snapshots of every aggregate type it holds, and the InMemoryQueryBackend of each, which passes QueryBackendSpec (:query-tck). A snapshot replaces the stored one of its ref only with a higher version, as a snapshot store does; a rebuilt one (rewrite) also replaces one of the same version. The host serves the snapshot queries of a node on the memory backend from it when wow.query.memory.enabled is on: for local runs, demos and tests, whose data does not outlive the node.

delay holds every primitive back that long before it answers, so tests can let a query outlive its timeout.

Constructors

Link copied to clipboard
constructor(delay: Duration = Duration.ZERO)

Functions

Link copied to clipboard

The binding of key, or null when this storage does not serve it.

Link copied to clipboard
fun records(type: AggregateType): List<ObjectNode>

The records of type, in the order their aggregates were first stored, each a fresh tree.

Link copied to clipboard

Stores snapshot, rebuilt from the log, in place of the stored one, as a snapshot store's rewrite does: unless a higher version is stored; returns whether it was.

Link copied to clipboard
fun save(snapshot: SnapshotRecord): Boolean

Stores snapshot unless a snapshot of the same or a higher version is stored; returns whether it was.