Перейти к содержимому
Русский

DynamoDbDurableStateStore

Это содержимое пока не доступно на вашем языке.

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 === 0PutItem with ConditionExpression: attribute_not_exists(pid).
  • expectedRevision > 0UpdateItem with ConditionExpression: 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.

new DynamoDbDurableStateStore(options?): DynamoDbDurableStateStore

Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:50

DynamoDbDurableStateStoreOptions = {}

DynamoDbDurableStateStore

DynamoDbStore.constructor

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.

Promise<void>

DurableStateStore.close

DynamoDbStore.close


delete(persistenceId): Promise<void>

Defined in: src/persistence/durable-state-stores/DynamoDbDurableStateStore.ts:144

Remove the record entirely. Idempotent.

string

Promise<void>

DurableStateStore.delete


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.

S

string

PersistenceOptions

Promise<Option<DurableStateRecord<S>>>

DurableStateStore.load


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.

S

string

number

S

PersistenceOptions

Promise<DurableStateRecord<S>>

DurableStateStore.upsert