symfonic.services.switching.store¶
store ¶
CUT-SS — the switch-state store: one record per bundle, per-key CAS.
The contract is the compare-and-swap semantics, not the vendor. This module
ships the in-process reference backend (CON-S-4); a Postgres/etcd/DynamoDB
adapter satisfies the same protocol by conditionally writing on epoch.
BundleRecord
dataclass
¶
BundleRecord(bundle_id: str, epoch: int, generation_vector: GenerationVector, freeze_state: FreezeState = NO_FREEZE, audit_head: str = '0' * 64, rollback_vector: GenerationVector | None = None, committed_at: float = 0.0)
CUT-SS-1/CUT-SS-3 — the entire binding state of one bundle.
One record, one atomic write. There is deliberately no way to express a half-switched bundle: the vector, the freeze and the audit head move together or not at all.
InMemorySwitchStore ¶
Per-key linearizable CAS over an in-process dict, with epoch history.
Every mutation takes the same lock and re-reads the current epoch inside
it, so a lost race raises SwitchConflictError instead of overwriting.
set_unreachable models the control-plane outage the availability rules
in CUT-BR exist to survive.
Source code in src/symfonic/services/switching/store.py
compare_and_swap
async
¶
CUT-SS-2 — commit record iff the stored epoch is still expected.
Source code in src/symfonic/services/switching/store.py
history
async
¶
CUT-SS-7 — the full epoch history, for audit reconstruction.