pub struct ProxyScheduler { /* private fields */ }Expand description
Proxy task scheduler.
Implementations§
Source§impl ProxyScheduler
impl ProxyScheduler
Sourcepub fn new(config: ProxySchedulerConfig) -> Self
pub fn new(config: ProxySchedulerConfig) -> Self
Create a new scheduler with the given config.
Sourcepub fn submit(
&mut self,
source: &str,
dest: &str,
estimated_secs: f64,
) -> Option<u64>
pub fn submit( &mut self, source: &str, dest: &str, estimated_secs: f64, ) -> Option<u64>
Submit a task to the scheduler queue. Returns the assigned task id.
Sourcepub fn complete_one(&mut self)
pub fn complete_one(&mut self)
Advance running tasks — mark the first running task as complete. In a real implementation this would be driven by async I/O callbacks.
Sourcepub fn running_count(&self) -> usize
pub fn running_count(&self) -> usize
Return the number of currently running tasks.
Sourcepub fn queued_count(&self) -> usize
pub fn queued_count(&self) -> usize
Return the number of queued (pending) tasks.
Sourcepub fn stats(&self) -> &ProxySchedulerStats
pub fn stats(&self) -> &ProxySchedulerStats
Return a reference to scheduler statistics.
Sourcepub fn record_elapsed(&mut self, secs: f64)
pub fn record_elapsed(&mut self, secs: f64)
Record elapsed time for statistics calculation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProxyScheduler
impl RefUnwindSafe for ProxyScheduler
impl Send for ProxyScheduler
impl Sync for ProxyScheduler
impl Unpin for ProxyScheduler
impl UnsafeUnpin for ProxyScheduler
impl UnwindSafe for ProxyScheduler
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