Skip to content
English

InMemorySnapshotStore

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:16

In-process snapshot store. Keeps all snapshots per persistenceId; loadLatest picks the newest, loadBefore the newest < seq. Plug-in implementations typically keep only the last N snapshots to save space — the in-memory one doesn’t bother. Stored state takes the same PayloadCodec round-trip a real store performs (#888): loads see the value a real backend would return, and later mutations of the caller’s object no longer alias into the store.

new InMemorySnapshotStore(): InMemorySnapshotStore

InMemorySnapshotStore

close(): Promise<void>

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:52

Best-effort teardown.

Promise<void>

SnapshotStore.close


delete(persistenceId, toSeq): Promise<void>

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:46

Delete snapshots up to and including toSeq. Useful for pruning.

string

number

Promise<void>

SnapshotStore.delete


loadBefore<S>(persistenceId, seq, _options?): Promise<Option<Snapshot<S>>>

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:37

Load the newest snapshot with sequenceNr < seq, or None.

S

string

number

PersistenceOptions

Promise<Option<Snapshot<S>>>

SnapshotStore.loadBefore


loadLatest<S>(persistenceId, _options?): Promise<Option<Snapshot<S>>>

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:31

Load the newest snapshot for persistenceId, or None if none exist. options.encryption is required when client-side encryption was used at write time — the store has no other way to obtain the master key. Stores that don’t encrypt ignore the field.

S

string

PersistenceOptions

Promise<Option<Snapshot<S>>>

SnapshotStore.loadLatest


save<S>(persistenceId, seq, state, _options?): Promise<Snapshot<S>>

Defined in: src/persistence/snapshot-stores/InMemorySnapshotStore.ts:19

Persist a snapshot at seq — typically the seq of the latest event applied. Optional options carry per-call preferences from the caller (e.g. compression/encryption set on the actor). Stores that cannot honour them silently ignore the field.

S

string

number

S

PersistenceOptions

Promise<Snapshot<S>>

SnapshotStore.save