Expand description
Versioned key-value objects for coordinating writers that share one store.
A CoordinationStore keeps small values (JSON documents, markers) under
slash-separated keys, each with a version number that changes on every
write. The only ways to write are create if absent and compare and
swap, which map onto what every backend can do atomically: a local
transaction (SQLite), an OS lock (a directory), or a conditional PUT
(If-None-Match: * / If-Match on S3 and R2, x-goog-if-generation-match
on GCS).
It is what a gateway uses for idempotency markers (webhook deliveries, cron fires: create-if-absent), leases and fencing (compare-and-swap), and anything else that must be decided exactly once across restarts.
Keys are namespaced per deployment with deployment_key, e.g.
d/<deployment>/runs/<run_id>.
Structs§
- Versioned
- A stored value and its version. Versions start at 1 and increase by one per write of the key.
Constants§
- MAX_
KEY_ BYTES - Largest key, in bytes.
- MAX_
VALUE_ BYTES - Largest value, in bytes. Coordination objects stay well below the single-PUT limits of object stores (5 MiB), so no backend needs multipart uploads.
Traits§
- Coordination
Store - Versioned objects written only with create-if-absent and compare-and-swap.
Functions§
- deployment_
key - The key of object
idofkindindeployment:d/<deployment>/<kind>/<id>. - validate_
key - Validate a coordination key: 1–
MAX_KEY_BYTESbytes of/-separated segments of[A-Za-z0-9_.:=-], none empty,.or... - validate_
value - Validate a value size.