Skip to main content

Dynamodb Datastore

@webframp/dynamodb-datastorev2026.07.25.1· 1d agoDATASTORES
01README

Stores swamp runtime data in AWS DynamoDB with conditional-write distributed locking (fencing tokens + TTL-as-defense-in-depth) and chunked blob storage for items exceeding DynamoDB's 400KB size limit. Emits OpenTelemetry spans for DynamoDB operations, lock acquisition/release, and push/pull sync so datastore activity is visible in traces when a TracerProvider is configured.

02Release Notes

2026.07.25.1

Added: OpenTelemetry spans for every layer of the datastore. Each SDK call emits one span named for the wire operation (DynamoDB PutItem, DynamoDB Query, DynamoDB BatchWriteItem, …) carrying aws.dynamodb.table_names, the GSI name when one is used, consumed capacity, returned and scanned counts, HTTP status, and the AWS request ID. The lock emits dynamodb-datastore lock acquire / release / withLock / inspect / forceRelease, with acquire recording wait duration and whether it contended. The sync service emits dynamodb-datastore pullChanged / pushChanged / hydrateFile / preparePush / commitPush with file counts, chunk counts, and fast-path indicators.

Added: Control-plane calls are covered too. DescribeTable, CreateTable, and UpdateTimeToLive go through the low-level client rather than the document client, so both clients are instrumented — table creation and health checks are no longer invisible.

Added: Retries are recorded as retry span events on the enclosing operation. This covers the throttling backoff in retryable, the UnprocessedKeys loop in BatchGetItem, and the UnprocessedItems loop in BatchWriteItem — the latter two retry independently of the shared helper and previously left no trace of partial throttling at all.

Changed: pullChanged reports datastore.files_pulled and datastore.files_deleted separately. The internal pull counter increments for both a downloaded file and a local file removed by a remote tombstone, so reporting it as a pull count would have overstated downloads.

Changed: Nothing observable without tracing configured. The extension depends on @opentelemetry/api only; the host process owns the TracerProvider, and every span is a no-op when none is registered. Existing behaviour, return values, and log output are unchanged.

Note: Item content is never recorded as a span attribute — only counts, key names, and table/index names.

Note: Span names are resolved from the SDK command's class identity rather than constructor.name, so they survive any minification the bundler applies. Lock heartbeat renewals run detached from the acquiring span, so a renewal is its own trace instead of a child of an already-ended lock acquire span.

03Datastores1
DynamoDB Datastoreconfigurable
@webframp/dynamodb-datastoredynamodb_datastore/mod.ts

Stores swamp runtime data in AWS DynamoDB with conditional-write distributed locking and chunked blob storage.

Config Fields

FieldTypeDescription
regionstringAWS region for the DynamoDB table
tableNamestringDynamoDB table name (single-table design: locks, file chunks/metadata, sync state)
endpoint?stringCustom endpoint URL — for DynamoDB Local or VPC endpoints only. Leave unset for production AWS.
autoCreateTablebooleanCreate the table (with GSI and TTL) on first use if missing. Requires
maxChunkBytesnumberMax raw bytes per chunk item before splitting a file across multiple DynamoDB items.
04Previous Versions5
2026.07.24.3
2026.07.24.2
2026.07.24.1

2026.07.24.1

Changed: Bump AWS SDK from 3.1091.0 to 3.1094.0 (patch-level update).

2026.07.23.1

2026.07.22.1

Added: Initial release of @webframp/dynamodb-datastore. Stores swamp runtime data in AWS DynamoDB using a single-table design (locks, chunked file blobs, and sync watermark share one table, keyed by pk/sk). Distributed locking uses conditional writes with fencing-token nonces; native DynamoDB TTL is used only as defense-in-depth cleanup of abandoned lock items — acquire-side staleness checks never depend on TTL sweep timing (which AWS documents as taking up to 48h).

Added: Two-phase sync (preparePush/commitPush) with per-file chunking for blobs exceeding DynamoDB's 400KB item limit (default 256KB raw chunk size, tunable via maxChunkBytes).

Added: endpoint config field for pointing at DynamoDB Local during development; autoCreateTable opt-in for provisioning the table on first use (default off — production tables should be provisioned via IaC; see the README's "Required Schema" section).

Credentials are never accepted in datastore config — this extension uses the AWS SDK's default credential provider chain (environment, shared config, IAM role), matching every other @webframp/aws/* extension in this repo.

2026.07.22.1

2026.07.22.1

Added: Initial release of @webframp/dynamodb-datastore. Stores swamp runtime data in AWS DynamoDB using a single-table design (locks, chunked file blobs, and sync watermark share one table, keyed by pk/sk). Distributed locking uses conditional writes with fencing-token nonces; native DynamoDB TTL is used only as defense-in-depth cleanup of abandoned lock items — acquire-side staleness checks never depend on TTL sweep timing (which AWS documents as taking up to 48h).

Added: Two-phase sync (preparePush/commitPush) with per-file chunking for blobs exceeding DynamoDB's 400KB item limit (default 256KB raw chunk size, tunable via maxChunkBytes).

Added: endpoint config field for pointing at DynamoDB Local during development; autoCreateTable opt-in for provisioning the table on first use (default off — production tables should be provisioned via IaC; see the README's "Required Schema" section).

Credentials are never accepted in datastore config — this extension uses the AWS SDK's default credential provider chain (environment, shared config, IAM role), matching every other @webframp/aws/* extension in this repo.

05Stats
A
100 / 100
Downloads
5
Archive size
292.4 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms
07Labels