Documentation
¶
Overview ¶
Package dynamodb implements the exchange.Store interface on top of DynamoDB.
Data model (single table, no secondary indexes). Items are grouped into one partition per time resolution:
pk = "rates#raw" sk = <nanos> rates (every sample) pk = "rates#hour" sk = <hour-start> ts, rates (close per hour) pk = "rates#day" sk = <day-start> ts, rates (close per day) pk = "rates#week" sk = <week-start> ts, rates (close per week, Sunday-start) pk = "rates#month" sk = <month-start> ts, rates (close per month)
Every item carries the full symbol->rate map for that instant; rollup items hold the map from the most recent sample in their bucket (the "close"). The sort key is the bucket-start time as unix-nanos (a Number), which sorts in chronological order. Rollup items also store `ts`, the close sample's actual time, which both drives the monotonic last-write-wins guard and is the timestamp returned for the point. Raw items omit `ts` because their sort key already is the sample time.
Writes fan out to all resolutions in a single transaction: the raw point is a conditional Put that enforces the once-per-timestamp contract, and each rollup is a monotonic last-write-wins Update. Reads serve the resolution matching the requested interval (see resolutionForInterval): the caller chooses an interval appropriate to the range and the store honors it directly. Point lookups always read the raw resolution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTables ¶
CreateTables provisions the exchange rate table with on-demand billing. The table is keyed by (pk, sk) with no secondary indexes. It is idempotent: a table that already exists is left as-is. The call blocks until the table is ACTIVE.
Types ¶
This section is empty.