pub struct InMemoryBudgetRegistry { /* private fields */ }Expand description
Pure in-memory BudgetRegistry backed by a BTreeMap.
This implementation is no_std friendly: it keeps a deterministic map
keyed by parent capability id and never reaches for clocks, locks, or
allocators outside alloc. Hosted callers that need shared mutable
access across threads should wrap it in their own Mutex / RwLock.
Implementations§
Trait Implementations§
Source§impl BudgetRegistry for InMemoryBudgetRegistry
impl BudgetRegistry for InMemoryBudgetRegistry
Source§fn register_parent(
&mut self,
parent_token_id: String,
parent_share_bps: u16,
) -> Result<(), BudgetSplitError>
fn register_parent( &mut self, parent_token_id: String, parent_share_bps: u16, ) -> Result<(), BudgetSplitError>
Register a parent token’s share so subsequent delegations can be
admitted against it. Re-registering the same parent with the same
share is idempotent. Re-registering with a different share is a hard
failure: the caller probably fed two distinct tokens with the same
id, which is a delegation-graph bug.
Source§fn try_admit_child(
&mut self,
parent_token_id: &str,
child_token_id: String,
share_bps: u16,
) -> Result<(), BudgetSplitError>
fn try_admit_child( &mut self, parent_token_id: &str, child_token_id: String, share_bps: u16, ) -> Result<(), BudgetSplitError>
Try to admit a child token under the given parent. Read more
Source§fn verify_child_admission(
&mut self,
parent_token_id: &str,
child_token_id: String,
share_bps: u16,
) -> Result<(), BudgetSplitError>
fn verify_child_admission( &mut self, parent_token_id: &str, child_token_id: String, share_bps: u16, ) -> Result<(), BudgetSplitError>
Check whether a child token would admit under the given parent WITHOUT
acquiring a holder lease. Read more
Source§fn release_child(
&mut self,
parent_token_id: &str,
child_token_id: &str,
expected_share_bps: u16,
) -> Result<(), BudgetSplitError>
fn release_child( &mut self, parent_token_id: &str, child_token_id: &str, expected_share_bps: u16, ) -> Result<(), BudgetSplitError>
Release a previously admitted child token under the given parent. Read more
Source§fn evict_parent(&mut self, parent_token_id: &str)
fn evict_parent(&mut self, parent_token_id: &str)
Drop the parent’s split from the registry. Idempotent; calling
evict_parent on an unregistered parent is a no-op so revocation
races do not abort verification.Source§impl Clone for InMemoryBudgetRegistry
impl Clone for InMemoryBudgetRegistry
Source§fn clone(&self) -> InMemoryBudgetRegistry
fn clone(&self) -> InMemoryBudgetRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryBudgetRegistry
impl Debug for InMemoryBudgetRegistry
Source§impl Default for InMemoryBudgetRegistry
impl Default for InMemoryBudgetRegistry
Source§fn default() -> InMemoryBudgetRegistry
fn default() -> InMemoryBudgetRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InMemoryBudgetRegistry
impl RefUnwindSafe for InMemoryBudgetRegistry
impl Send for InMemoryBudgetRegistry
impl Sync for InMemoryBudgetRegistry
impl Unpin for InMemoryBudgetRegistry
impl UnsafeUnpin for InMemoryBudgetRegistry
impl UnwindSafe for InMemoryBudgetRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more