pub struct WorkScheduler { /* private fields */ }Expand description
Work scheduler for distributing items to agents
Implementations§
Source§impl WorkScheduler
impl WorkScheduler
Sourcepub fn new(strategy: SchedulingStrategy, items: Vec<Value>) -> Self
pub fn new(strategy: SchedulingStrategy, items: Vec<Value>) -> Self
Create a new scheduler with the specified strategy
Sourcepub async fn next_item(&self) -> Option<WorkItem>
pub async fn next_item(&self) -> Option<WorkItem>
Get the next work item according to the scheduling strategy
Sourcepub async fn next_batch(&self, batch_size: usize) -> Vec<WorkItem>
pub async fn next_batch(&self, batch_size: usize) -> Vec<WorkItem>
Get a batch of work items
Sourcepub async fn remaining_count(&self) -> usize
pub async fn remaining_count(&self) -> usize
Get remaining item count
Sourcepub async fn processed_count(&self) -> usize
pub async fn processed_count(&self) -> usize
Get processed item count
Sourcepub async fn is_complete(&self) -> bool
pub async fn is_complete(&self) -> bool
Check if all items have been scheduled
Auto Trait Implementations§
impl !RefUnwindSafe for WorkScheduler
impl !UnwindSafe for WorkScheduler
impl Freeze for WorkScheduler
impl Send for WorkScheduler
impl Sync for WorkScheduler
impl Unpin for WorkScheduler
impl UnsafeUnpin for WorkScheduler
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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