Skip to main content

Module gate

Module gate 

Source
Expand description

Keeps every at-rest write on the key the store uses. A writer holds a Sealing ticket from before it reads the vault (or the enabled flag) until its row is written; a migration holds KeyChange from before its transaction until the vault and the flag show the result. A value sealed under one key can then never land after the store has moved to another.

Tickets are not Send, so on native neither can be held across an .await in a spawned task: the encrypt and the write it protects stay one synchronous step. The web’s tasks need not be Send, so there that is a rule, enforced by a panic if it is ever broken.

Structs§

KeyChange
Held by a migration from before its transaction until the vault and the flag are updated.
Sealing
Held by a writer across its encrypt and its write.

Functions§

held
Whether this thread may seal a value right now: inside a writer’s ticket or a migration.
key_change
Wait for in-flight writers to land, then hold new ones off until this ticket drops.
sealing
Wait out any key change, then hold one off until this ticket drops.
switching
key_change for an account switch: waits out writers in flight. Nested inside a write or a migration on this thread it holds nothing, since waiting there would wait on itself.