UniqueHandle
Single current authority over a transferable resource reference
Mechanism
An authority-bearing reference to one singular rivalrous Resource. An authoritative ownership state records `(resource_id, current_holder, generation)`. A representation may be copied, but the representation alone grants no authority: use or transfer is accepted only when its holder and generation match that state and the requester establishes current-holder control; stale or unverified representations fail closed. Transfer from A at generation g to B conditionally replaces `(A, g)` with `(B, g+1)` at one logical commit point. It either commits completely or leaves `(A, g)` unchanged, and at most one concurrent transfer from g commits. If the result is unobserved, the caller resolves the authoritative state before using or retrying the handle.
Invariants
- Single current authority: Exactly one `(holder, generation)` pair is current for each bound Resource; copying a representation does not create authority.
- Current-only authority: Use or transfer is accepted only when the presented holder and generation match the authoritative ownership state and current-holder control is established; the representation alone is insufficient.
- Atomic transfer: A transfer conditioned on `(A, g)` either commits `(B, g+1)` completely or leaves `(A, g)` unchanged; at most one transfer from the same generation commits.
- Unknown outcome: A caller that did not observe the transfer result resolves the authoritative state before using or retrying the handle.
Failure modes
- Orphaned authority: The current holder loses the substrate-specific means of proving control, leaving the resource inaccessible until an external recovery policy advances the generation.
- Authority-state unavailability: Currency cannot be established, so access and transfer fail closed.
- Authority-state fork: Different validators accept different holder-generation pairs as current, violating singular authority.
Where this came from
—
Builds on
- Resource references
Used by
- HeldRelease accepts
Identity
- Ref:
UniqueHandle#1853 - Hash: sema:UniqueHandle#mh:SHA-256:185337050ca62b46cf88be534139cf31c2313c660f845daa395507c7faebcb1c
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository