@mayurajs/storage-dynamodb
v1.2.0
Published
Mayura storage on Amazon DynamoDB, as optimistic transactions through the official AWS SDK.
Readme
@mayurajs/storage-dynamodb
Mayura storage on Amazon DynamoDB, through the official AWS SDK: everything the SQL stores keep, in one table.
npm install mayura @mayurajs/storage-dynamodbimport { createDynamoStore } from '@mayurajs/storage-dynamodb';
const store = createDynamoStore({ table: 'mayura', region: 'us-east-1', credentials });
await store.initialize();- The table has a string partition key
pand string sort keys.createTable: truecreates it (on-demand capacity) when it is missing; nothing is created otherwise. - Region and credentials are options: nothing is read from the environment, AWS config files or instance metadata.
Requests go through
fetch, so the store runs wherever fetch does. Or pass aDynamoDBClientyou own asclient. - Mayura's state machines run as optimistic transactions: each reads consistently, holds its writes, and commits one
TransactWriteItemsthat applies only if nothing it locked or wrote changed; otherwise it runs again. - DynamoDB has no clock to read: leases use your hosts' clocks, so keep them synchronized. Documents over 400 KB are
split into chunk items; an operation that needs more than DynamoDB's 100 items per transaction fails whole with
LIMIT_EXCEEDED.
See the storage guide. Apache-2.0.
