Infrastructure · Primitives
IdempotentWrite
Safe retries via unique keys
Definition
Mechanism
A technical primitive where every write request includes a unique 'Idempotency Key'. The receiver maintains a Cache of processed keys. If it receives a duplicate key, it returns the stored result without re-executing the side effects. This makes 'At-Least-Once' delivery safe. It uses a keyed StateLock to deduplicate requests, ensuring only the first write executes while subsequent ones return the cached result.
Preconditions
- Receiver has state storage for keys
Postconditions
- Action executed exactly once (logically)
Invariants
- Idempotence: Apply(Apply(Req)) stands in Equivalence with Apply(Req) — a repeated key returns the first result rather than executing again.
- Safety: Duplicate requests trigger zero additional side effects
Risks
Failure modes
Key collision (two different requests use same key).
Relationships
Builds on
References
Keyed storage for reusing previously obtained values
Sameness decided by canonical content rather than by label
Society
Atomic coordination via temporary state fusion
Used by
References
Durable persistence of volatile state
Reference
