pub trait AllocationAccount: Send + Sync {
// Required methods
fn check(&self) -> Result<(), ProgramStop>;
fn admit(&self, cost: AllocationCost) -> Result<(), ProgramStop>;
fn refund(&self, bytes: u64, class: AllocationClass);
fn stop(&self, stop: ProgramStop) -> ProgramStop;
// Provided method
fn observe(&self, _event: StorageEvent, _class: AllocationClass) { ... }
}Expand description
Implementations must allocate nothing, never panic, and consult no ambient account. Refund is cleanup-only and must validate category and total before subtracting. Admission commits cancellation/terminal checks under its ledger lock. Existing cumulative costs are never refunded. This is not source authority.
Required Methods§
fn check(&self) -> Result<(), ProgramStop>
fn admit(&self, cost: AllocationCost) -> Result<(), ProgramStop>
fn refund(&self, bytes: u64, class: AllocationClass)
fn stop(&self, stop: ProgramStop) -> ProgramStop
Provided Methods§
Sourcefn observe(&self, _event: StorageEvent, _class: AllocationClass)
fn observe(&self, _event: StorageEvent, _class: AllocationClass)
Optional actual-storage observation, after delegated Global operations.