DynamoDB-backed VtnStorage implementation using Cognitect aws-api.
Single-table design: PK: objectType (S) — PROGRAM, EVENT, SUBSCRIPTION SK: id (S) — UUID
GSIs: programName-index: PK=objectType, SK=programName programID-index: PK=programID, SK=id objectType-eventStart-index: PK=objectType, SK=eventStart (date-range queries) programID-eventStart-index: PK=programID, SK=eventStart (per-program date-range)
Wire-storage boundary
Entities held in memory are canonically ZonedDateTime /
Duration. At the DDB boundary:
* :data attr is a JSON blob; the JSONWriter protocol extension in
vtn.time serialises ZDT → canonical UTC Z and Duration → ISO.
* :eventStart GSI sort key is canonical UTC Z (lex-orderable
regardless of the wire offset on the input).
On read, the JSON blob is parsed and known datetime fields are
re-hydrated to ZDT / Duration before being returned.
Caching: Programs: cached with long TTL (default 1 hour) — rarely change Events: cached per-page with short TTL (default 5 min) keyed by canonical-string query args Caches invalidated on any mutation (create/update/delete)
DynamoDB-backed VtnStorage implementation using Cognitect aws-api.
Single-table design:
PK: objectType (S) — PROGRAM, EVENT, SUBSCRIPTION
SK: id (S) — UUID
GSIs:
programName-index: PK=objectType, SK=programName
programID-index: PK=programID, SK=id
objectType-eventStart-index: PK=objectType, SK=eventStart (date-range queries)
programID-eventStart-index: PK=programID, SK=eventStart (per-program date-range)
Wire-storage boundary
Entities held in memory are canonically `ZonedDateTime` /
`Duration`. At the DDB boundary:
* `:data` attr is a JSON blob; the JSONWriter protocol extension in
`vtn.time` serialises ZDT → canonical UTC Z and Duration → ISO.
* `:eventStart` GSI sort key is canonical UTC Z (lex-orderable
regardless of the wire offset on the input).
On read, the JSON blob is parsed and known datetime fields are
re-hydrated to ZDT / Duration before being returned.
Caching:
Programs: cached with long TTL (default 1 hour) — rarely change
Events: cached per-page with short TTL (default 5 min)
keyed by canonical-string query args
Caches invalidated on any mutation (create/update/delete)(ensure-table! client table)Create the DynamoDB table and GSIs if they don't exist. Intended for local development (DynamoDB Local) and testing.
Create the DynamoDB table and GSIs if they don't exist. Intended for local development (DynamoDB Local) and testing.
(new-dynamo-storage)Create a DynamoStorage component. Depends on :config.
Create a DynamoStorage component. Depends on :config.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |