pub struct DrainController { /* private fields */ }Expand description
Controller coordinating safe quiescence and maintenance transitions.
Implementations§
Source§impl DrainController
impl DrainController
Sourcepub const fn new(initial_generation: u64) -> Self
pub const fn new(initial_generation: u64) -> Self
Construct a new controller starting in Normal state at generation initial_generation.
Sourcepub fn state(&self) -> DrainState
pub fn state(&self) -> DrainState
Current lifecycle state.
Sourcepub fn active_generation(&self) -> u64
pub fn active_generation(&self) -> u64
Active model residency generation.
Sourcepub fn reason(&self) -> Option<DrainReason>
pub fn reason(&self) -> Option<DrainReason>
Current drain reason, if draining or in maintenance.
Sourcepub fn is_admission_allowed(&self) -> bool
pub fn is_admission_allowed(&self) -> bool
Whether new admissions are allowed into the scheduler.
Sourcepub fn request_drain(
&mut self,
reason: DrainReason,
active_requests: usize,
current_epoch: u64,
) -> Result<DrainState, DrainError>
pub fn request_drain( &mut self, reason: DrainReason, active_requests: usize, current_epoch: u64, ) -> Result<DrainState, DrainError>
Request a drain for maintenance.
If there are already 0 active requests, immediately transitions to Quiesced.
Sourcepub fn poll_drain_progress(&mut self, active_requests: usize) -> DrainState
pub fn poll_drain_progress(&mut self, active_requests: usize) -> DrainState
Notify the controller of the current count of active requests.
If in Draining state and active_requests == 0, transitions to Quiesced.
Sourcepub fn abort_drain(&mut self) -> Result<(), DrainError>
pub fn abort_drain(&mut self) -> Result<(), DrainError>
Abort an in-progress drain and return to Normal operation without bumping generation.
Sourcepub fn begin_maintenance(&mut self) -> Result<(), DrainError>
pub fn begin_maintenance(&mut self) -> Result<(), DrainError>
Begin exclusive maintenance. Requires the controller to be in Quiesced state.
Sourcepub fn complete_maintenance(
&mut self,
new_generation: u64,
) -> Result<(), DrainError>
pub fn complete_maintenance( &mut self, new_generation: u64, ) -> Result<(), DrainError>
Complete maintenance, bumping to new_generation and restoring Normal operation.
Trait Implementations§
Source§impl Clone for DrainController
impl Clone for DrainController
impl Copy for DrainController
Auto Trait Implementations§
impl Freeze for DrainController
impl RefUnwindSafe for DrainController
impl Send for DrainController
impl Sync for DrainController
impl Unpin for DrainController
impl UnsafeUnpin for DrainController
impl UnwindSafe for DrainController
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>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ⓘ
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> ⓘ
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