pub(crate) struct SchedulerState {
inner: RwLock<InnerSchedulerState>,
}
Expand description
State of the IO scheduler, as stored on the Context
.
The IO scheduler can be stopped or started, but core can also pause it. After pausing
the IO scheduler will be restarted only if it was running before paused or
Context::start_io
was called in the meantime while it was paused.
Fields§
§inner: RwLock<InnerSchedulerState>
Implementations§
source§impl SchedulerState
impl SchedulerState
pub(crate) fn new() -> Self
sourcepub(crate) async fn is_running(&self) -> bool
pub(crate) async fn is_running(&self) -> bool
Whether the scheduler is currently running.
sourcepub(crate) async fn start(&self, context: Context)
pub(crate) async fn start(&self, context: Context)
Starts the scheduler if it is not yet started.
sourceasync fn do_start(
inner: RwLockWriteGuard<'_, InnerSchedulerState>,
context: Context,
)
async fn do_start( inner: RwLockWriteGuard<'_, InnerSchedulerState>, context: Context, )
Starts the scheduler if it is not yet started.
sourcepub(crate) async fn stop(&self, context: &Context)
pub(crate) async fn stop(&self, context: &Context)
Stops the scheduler if it is currently running.
sourceasync fn do_stop(
inner: RwLockWriteGuard<'_, InnerSchedulerState>,
context: &Context,
new_state: InnerSchedulerState,
)
async fn do_stop( inner: RwLockWriteGuard<'_, InnerSchedulerState>, context: &Context, new_state: InnerSchedulerState, )
Stops the scheduler if it is currently running.
sourcepub(crate) async fn pause(&self, context: Context) -> Result<IoPausedGuard>
pub(crate) async fn pause(&self, context: Context) -> Result<IoPausedGuard>
Pauses the IO scheduler.
If it is currently running the scheduler will be stopped. When the
IoPausedGuard
is dropped the scheduler is started again.
If in the meantime SchedulerState::start
or SchedulerState::stop
is called
resume will do the right thing and restore the scheduler to the state requested by
the last call.
sourcepub(crate) async fn restart(&self, context: &Context)
pub(crate) async fn restart(&self, context: &Context)
Restarts the scheduler, only if it is running.
sourcepub(crate) async fn maybe_network(&self)
pub(crate) async fn maybe_network(&self)
Indicate that the network likely has come back.
sourcepub(crate) async fn maybe_network_lost(&self, context: &Context)
pub(crate) async fn maybe_network_lost(&self, context: &Context)
Indicate that the network likely is lost.
pub(crate) async fn interrupt_inbox(&self)
sourcepub(crate) async fn interrupt_oboxes(&self)
pub(crate) async fn interrupt_oboxes(&self)
Interrupt optional boxes (mvbox, sentbox) loops.