PostgresSnapshotStore
Ce contenu n’est pas encore disponible dans votre langue.
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:35
SnapshotStore backed by PostgreSQL (pg). One row per
(persistence_id, sequence_nr); loadLatest is an indexed
ORDER BY sequence_nr DESC LIMIT 1. Prune-on-save keeps the newest
keepN. PersistenceOptions (compression/encryption) are ignored —
like the SQLite and Cassandra stores, payloads are stored as JSON text.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PostgresSnapshotStore(
options?):PostgresSnapshotStore
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:45
Parameters
Section titled “Parameters”options?
Section titled “options?”PostgresSnapshotStoreOptions = {}
Returns
Section titled “Returns”PostgresSnapshotStore
Methods
Section titled “Methods”close()
Section titled “close()”close():
Promise<void>
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:102
Best-effort teardown.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”delete()
Section titled “delete()”delete(
pid,toSeq):Promise<void>
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:94
Delete snapshots up to and including toSeq. Useful for pruning.
Parameters
Section titled “Parameters”string
number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”loadBefore()
Section titled “loadBefore()”loadBefore<
S>(pid,seq,_options?):Promise<Option<Snapshot<S>>>
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:84
Load the newest snapshot with sequenceNr < seq, or None.
Type Parameters
Section titled “Type Parameters”S
Parameters
Section titled “Parameters”string
number
_options?
Section titled “_options?”PersistenceOptions
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”loadLatest()
Section titled “loadLatest()”Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:74
Load the newest snapshot for pid, 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.
Type Parameters
Section titled “Type Parameters”S
Parameters
Section titled “Parameters”string
_options?
Section titled “_options?”PersistenceOptions
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”save()
Section titled “save()”save<
S>(pid,seq,state,_options?):Promise<Snapshot<S>>
Defined in: src/persistence/snapshot-stores/PostgresSnapshotStore.ts:52
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.
Type Parameters
Section titled “Type Parameters”S
Parameters
Section titled “Parameters”string
number
S
_options?
Section titled “_options?”PersistenceOptions
Returns
Section titled “Returns”Promise<Snapshot<S>>