pub struct BudgetChecker { /* private fields */ }Expand description
Cross-partition budget checker with per-cycle caching.
Created once per scheduler instance. Call clear_cache() at the start
of each scheduling cycle to invalidate stale status.
Implementations§
Source§impl BudgetChecker
impl BudgetChecker
pub fn new(client: Client, partition_config: PartitionConfig) -> Self
Sourcepub async fn check_budget(
&mut self,
budget_id: &BudgetId,
) -> Result<BudgetStatus, Error>
pub async fn check_budget( &mut self, budget_id: &BudgetId, ) -> Result<BudgetStatus, Error>
Check budget status, returning cached value if available.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the per-cycle cache. Call at the start of each scheduling cycle.
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Number of cached budget statuses.
Auto Trait Implementations§
impl Freeze for BudgetChecker
impl !RefUnwindSafe for BudgetChecker
impl Send for BudgetChecker
impl Sync for BudgetChecker
impl Unpin for BudgetChecker
impl UnsafeUnpin for BudgetChecker
impl !UnwindSafe for BudgetChecker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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