Documentation
¶
Overview ¶
Package dynamodb implements the holder.Store interface on top of DynamoDB.
Two tables, both keyed per mint (the number of mints is unbounded, so each record is its own item — never a map-of-all-mints row):
History table — per-mint time series, one partition per resolution:
pk = "<mint>#raw" sk = <nanos> count (every sample) pk = "<mint>#hour" sk = <hour-start> count, ts (close per hour) pk = "<mint>#day" sk = <day-start> count, ts (close per day) pk = "<mint>#week" sk = <week-start> count, ts (close per week, Sunday-start) pk = "<mint>#month" sk = <month-start> count, ts (close per month)
Writes fan out to all resolutions in one transaction: the raw point is a conditional Put enforcing once-per-timestamp, each rollup a monotonic last-write-wins Update holding the bucket close. Rollup items store `ts` (the close sample's time, which also drives the guard); raw items omit it because their sort key already is the sample time. Reads serve the resolution matching the requested interval; point lookups read the raw resolution at or before t.
Live table — latest snapshot per mint, keyed by pk = "<mint>" (no sort key):
pk = "<mint>" count, ts
Live writes spread across mints (each mint its own partition); the timestamp-monotonic condition keeps the most recent sample. GetAllLiveHolderCounts scans this table — it holds one item per mint, so the scan touches only live state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTables ¶
func CreateTables(ctx context.Context, client *dynamodb.Client, historyTable, liveTable string) error
CreateTables provisions the history and live holder-count tables with on-demand billing. The history table is keyed by (pk, sk); the live table is keyed by pk only (one item per mint) so it can be scanned cheaply for all mints. It is idempotent and blocks until both tables are ACTIVE.
Types ¶
This section is empty.