pub struct AttentionAllocator { /* private fields */ }Expand description
Attention Allocator manages attention budgets for all Resonators
Attention is the finite capacity of a Resonator to process resonance.
Implementations§
Source§impl AttentionAllocator
impl AttentionAllocator
pub fn new(config: &AttentionConfig) -> Self
Sourcepub async fn allocate_budget(
&self,
resonator: &ResonatorId,
spec: &AttentionBudgetSpec,
) -> Result<(), String>
pub async fn allocate_budget( &self, resonator: &ResonatorId, spec: &AttentionBudgetSpec, ) -> Result<(), String>
Allocate attention budget for a new Resonator
Sourcepub async fn allocate(
&self,
resonator: &ResonatorId,
amount: u64,
) -> Result<AllocationToken, AttentionError>
pub async fn allocate( &self, resonator: &ResonatorId, amount: u64, ) -> Result<AllocationToken, AttentionError>
Allocate attention for a coupling
Returns error if insufficient attention (prevents over-coupling)
Sourcepub async fn allocate_more(
&self,
resonator: &ResonatorId,
amount: u64,
) -> Result<(), AttentionError>
pub async fn allocate_more( &self, resonator: &ResonatorId, amount: u64, ) -> Result<(), AttentionError>
Allocate more attention to an existing coupling
Sourcepub async fn release_partial(&self, resonator: &ResonatorId, amount: u64)
pub async fn release_partial(&self, resonator: &ResonatorId, amount: u64)
Release attention (partial)
Sourcepub async fn release_all(&self, resonator: &ResonatorId, amount: u64)
pub async fn release_all(&self, resonator: &ResonatorId, amount: u64)
Release all attention from a coupling
Sourcepub fn is_exhaustion_imminent(&self, resonator: &ResonatorId) -> bool
pub fn is_exhaustion_imminent(&self, resonator: &ResonatorId) -> bool
Check if attention exhaustion is imminent
Sourcepub async fn available_for_coupling(
&self,
resonator: &ResonatorId,
) -> Result<u64, AttentionError>
pub async fn available_for_coupling( &self, resonator: &ResonatorId, ) -> Result<u64, AttentionError>
Get available attention for coupling
Sourcepub async fn get_budget(
&self,
resonator: &ResonatorId,
) -> Option<AttentionBudget>
pub async fn get_budget( &self, resonator: &ResonatorId, ) -> Option<AttentionBudget>
Get budget for a Resonator
Sourcepub async fn restore_budget(
&self,
resonator: &ResonatorId,
budget: &AttentionBudget,
) -> Result<(), String>
pub async fn restore_budget( &self, resonator: &ResonatorId, budget: &AttentionBudget, ) -> Result<(), String>
Restore attention budget from continuity record
Sourcepub async fn rebalance(&self, _resonator: &ResonatorId)
pub async fn rebalance(&self, _resonator: &ResonatorId)
Rebalance attention across couplings
Called when attention pressure is high to optimize allocation
Sourcepub fn remove_budget(&self, resonator: &ResonatorId)
pub fn remove_budget(&self, resonator: &ResonatorId)
Remove budget (for cleanup)
Auto Trait Implementations§
impl Freeze for AttentionAllocator
impl !RefUnwindSafe for AttentionAllocator
impl Send for AttentionAllocator
impl Sync for AttentionAllocator
impl Unpin for AttentionAllocator
impl UnwindSafe for AttentionAllocator
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