Commit f169158
committed
Implement tiered storage
This commit adds `TierStore`, a tiered `KVStore` implementation that
routes node persistence across three storage roles:
- a primary store for durable, authoritative data
- an optional backup store for a second durable copy of primary-backed data
- an optional ephemeral store for rebuildable cached data such as the
network graph and scorer
TierStore routes ephemeral cache data to the ephemeral store when configured,
while durable data remains primary and backup. Reads do not consult the backup
store during normal operation. Unpaginated listings expose the logical contents
of the primary and ephemeral tiers without consulting the backup store; paginated
listings currently expose only the primary tier.
For primary+backup writes and removals, this implementation treats the
backup store as part of the persistence success path rather than as a
best-effort background mirror. Earlier designs used asynchronous backup
queueing to avoid blocking the primary path, but that weakens the
durability contract by allowing primary success to be reported before
backup persistence has completed. TierStore now issues primary and backup
operations together and only returns success once both complete.
This gives callers a clearer persistence guarantee when a backup store is
configured: acknowledged primary+backup mutations have been attempted
against both durable stores. The tradeoff is that dual-store operations
are not atomic across stores, so an error may still be returned after one
store has already been updated.
Additionally, adds unit coverage for the current contract, including:
- basic read/write/remove/list persistence
- routing of ephemeral data away from the primary store
- backup participation in the foreground success path for writes and removals
Assisted-by: Amp (AI coding agent)1 parent 6480bff commit f169158
2 files changed
Lines changed: 1455 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments