Expand description
Owning release: lifecycle vocabulary, structured outcomes, and the provider/context-owned deferred release queue.
Phase 3 issued binding identity, allocation generations, and lifetime pins. This module adds the piece that identity alone cannot express: who owns the final physical release, and what is true after it partially fails.
§The three-step contract
- Prepare.
crate::MemoryBinding::prepare_releasematches the binding identity and the allocation generation, removes the live record exactly once under the per-mechanism lock, and returns an ownedPreparedAllocationRelease. Because the record is removed under that lock, two racing final releases cannot both proceed, and a stale handle whose virtual address was reused cannot match a newer generation. - Queue (optional). The prepared request is handed to a
DeferredReleaseQueueowned by the provider context. Every queue call happens after all registry and mechanism locks are dropped. - Execute.
PreparedAllocationRelease::executecalls the pinned allocator with no lock held and returns anAllocationReleaseOutcome.
§Fail-safe rules
- A prepared request that is abandoned (dropped without
execute) quarantines its ownership. It never frees, never blocks, and never loses metadata. - Enqueue failure returns the exact request to the caller inside
DeferredEnqueueError; dropping that error quarantines the request rather than losing it. - Device loss never calls the allocator. Queued requests finish as device-lost quarantine while keeping their allocator/authority/context pins.
- No
Err/Failedshape may imply “nothing changed” after the device was mutated. Any partial mutation isAllocationReleaseOutcome::Quarantinedand carries accounting plus residual facts.
Structs§
- Deferred
Enqueue Error - Enqueue failure that hands the exact prepared request back.
- Prepared
Allocation Release - Final ownership of one allocation, detached from its live record.
- Quarantined
Allocation - One piece of ownership the runtime kept instead of releasing.
- Release
Accounting - Byte accounting for one release attempt.
- Release
Failure - A release that failed before any device mutation.
- Residual
Ownership - What the runtime still owns after a non-complete release.
Enums§
- Allocation
Release Outcome - The structured result of one whole-allocation release.
- Allocation
Release State - Where one allocation’s ownership currently sits.
- Deferred
Enqueue Rejection - Why a
DeferredReleaseQueuerefused final ownership. - Deferred
Release Disposition - What happened when an owning allocation was handed to a deferred queue.
- Quarantine
Reason - Why ownership was retained instead of released.
Traits§
- Deferred
Release Queue - A provider/context-owned sink for final allocation ownership.