pub struct AdmittedCurrencies {
pub reservation: RequestReservation,
pub allocated_blocks: Vec<u32>,
}Expand description
A verified and committed reservation across both budget and physical block pool.
Fields§
§reservation: RequestReservation§allocated_blocks: Vec<u32>Implementations§
Source§impl AdmittedCurrencies
impl AdmittedCurrencies
Sourcepub fn reserve(
budget: &MemoryPoolBudget,
pool: &mut BlockPool,
input_tokens: u32,
reserved_output_tokens: u32,
cow_blocks: u32,
active_cow_blocks: u32,
active_reserved_bytes: u64,
) -> Result<Self, AdmissionError>
pub fn reserve( budget: &MemoryPoolBudget, pool: &mut BlockPool, input_tokens: u32, reserved_output_tokens: u32, cow_blocks: u32, active_cow_blocks: u32, active_reserved_bytes: u64, ) -> Result<Self, AdmissionError>
Attempt to reserve all required currencies for a request.
Evaluates:
- Byte budget and cumulative COW headroom via
MemoryPoolBudget::reserve_with_active_cow. - Physical block availability in
BlockPool. - Atomically allocates blocks from
BlockPoolinto an active reservation ledger.
Fails closed: if any check or allocation fails, all allocated blocks are rolled back.
Sourcepub fn release(&mut self, pool: &mut BlockPool)
pub fn release(&mut self, pool: &mut BlockPool)
Explicitly release all reserved physical blocks back to the pool.
Sourcepub fn allocated_blocks(&self) -> &[u32]
pub fn allocated_blocks(&self) -> &[u32]
Allocates; error on exhaustion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdmittedCurrencies
impl RefUnwindSafe for AdmittedCurrencies
impl Send for AdmittedCurrencies
impl Sync for AdmittedCurrencies
impl Unpin for AdmittedCurrencies
impl UnsafeUnpin for AdmittedCurrencies
impl UnwindSafe for AdmittedCurrencies
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more