DynamoDbDurableStateStore
Este conteúdo não está disponível em sua língua ainda.
Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:45
DurableStateStore backed by Amazon DynamoDB — the “event-free” cousin of event sourcing, one item per persistence id rewritten in place.
This is the contract DynamoDB fits best of the three: compare-and-swap is a native conditional write, needing neither a transaction nor a read-back.
expectedRevision === 0→PutItemwithConditionExpression: attribute_not_exists(pid).expectedRevision > 0→UpdateItemwithConditionExpression: revision = :expected.
Both surface a collision as ConditionalCheckFailedException, and the current
revision is then read back so the error reports what the caller actually raced
against. revision goes through an expression attribute name because it is
short enough to collide with a DynamoDB reserved word in future API versions —
cheap insurance in a place that would otherwise fail at runtime only.
Extends
Section titled “Extends”Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DynamoDbDurableStateStore(
options?):DynamoDbDurableStateStore
Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:50
Parameters
Section titled “Parameters”options?
Section titled “options?”DynamoDbDurableStateStoreOptions = {}
Returns
Section titled “Returns”DynamoDbDurableStateStore
Overrides
Section titled “Overrides”DynamoDbStore.constructor
Methods
Section titled “Methods”close()
Section titled “close()”close():
Promise<void>
Defined in: src/persistence/LazyStore.ts:66
Best-effort teardown; idempotent.
Journal and SnapshotStore have carried this since they were written;
DurableStateStore was the one contract of the three without it, even
though its implementations hold exactly the same kind of resource — a
connection pool, an HTTP client, a SQLite file handle. Callers that own a
store therefore had no contractual way to release it, and the test suite
leaned on closeQuietly probing for the method.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”delete()
Section titled “delete()”delete(
persistenceId):Promise<void>
Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:144
Remove the record entirely. Idempotent.
Parameters
Section titled “Parameters”persistenceId
Section titled “persistenceId”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”load()
Section titled “load()”load<
S>(persistenceId,_options?):Promise<Option<DurableStateRecord<S>>>
Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:126
Load the latest record for persistenceId, or None if none exists.
options.encryption is required when client-side encryption was
used at write time.
Type Parameters
Section titled “Type Parameters”S
Parameters
Section titled “Parameters”persistenceId
Section titled “persistenceId”string
_options?
Section titled “_options?”PersistenceOptions
Returns
Section titled “Returns”Promise<Option<DurableStateRecord<S>>>
Implementation of
Section titled “Implementation of”upsert()
Section titled “upsert()”upsert<
S>(persistenceId,expectedRevision,state,_options?):Promise<DurableStateRecord<S>>
Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:71
Upsert the state for persistenceId. expectedRevision must match the
current stored revision (0 when no record exists yet). Throws
DurableStateConcurrencyError on conflict. 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”persistenceId
Section titled “persistenceId”string
expectedRevision
Section titled “expectedRevision”number
S
_options?
Section titled “_options?”PersistenceOptions
Returns
Section titled “Returns”Promise<DurableStateRecord<S>>
