pub struct EpochController { /* private fields */ }Expand description
Controls compute-tick budgeting across phases within an epoch.
Implementations§
Source§impl EpochController
impl EpochController
Sourcepub fn new(budget: ContainerEpochBudget) -> Self
pub fn new(budget: ContainerEpochBudget) -> Self
Create a new controller with the given budget.
Sourcepub fn try_budget(&mut self, phase: Phase) -> bool
pub fn try_budget(&mut self, phase: Phase) -> bool
Check whether phase still has budget remaining.
If yes, sets the current phase and returns true.
Sourcepub fn consume(&mut self, ticks: u64)
pub fn consume(&mut self, ticks: u64)
Consume ticks from both the total budget and the current phase budget.
Sourcepub fn phase_budget(&self, phase: Phase) -> u64
pub fn phase_budget(&self, phase: Phase) -> u64
Total tick budget allocated to phase.
Sourcepub fn phase_used(&self, phase: Phase) -> u64
pub fn phase_used(&self, phase: Phase) -> u64
Ticks consumed so far by phase.
Auto Trait Implementations§
impl Freeze for EpochController
impl RefUnwindSafe for EpochController
impl Send for EpochController
impl Sync for EpochController
impl Unpin for EpochController
impl UnsafeUnpin for EpochController
impl UnwindSafe for EpochController
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