pub struct Scheduler<P> { /* private fields */ }Expand description
Pipeline scheduler that manages batch submission and interleaving.
The scheduler doesn’t own backends directly — instead, callers use
Scheduler::next_batch to get the next group of items to submit,
then handle submission/polling themselves. This keeps the scheduler
backend-agnostic and testable.
Implementations§
Source§impl<P> Scheduler<P>
impl<P> Scheduler<P>
Sourcepub fn new(config: SchedulerConfig) -> Self
pub fn new(config: SchedulerConfig) -> Self
Create a new scheduler with the given configuration.
Sourcepub fn enqueue(&mut self, items: impl IntoIterator<Item = WorkItem<P>>)
pub fn enqueue(&mut self, items: impl IntoIterator<Item = WorkItem<P>>)
Add work items to the scheduler’s queue.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of items currently in the queue.
Sourcepub fn next_batch(&mut self) -> Option<Vec<BatchGroup<P>>>
pub fn next_batch(&mut self) -> Option<Vec<BatchGroup<P>>>
Take the next batch of work items from the queue, grouped optimally.
Returns None if the queue is empty. Otherwise returns a vec of
BatchGroups, each containing items that should be submitted
together for optimal cache utilization.
Items past max_wait are promoted into this batch regardless of
grouping optimality.
Auto Trait Implementations§
impl<P> Freeze for Scheduler<P>
impl<P> RefUnwindSafe for Scheduler<P>where
P: RefUnwindSafe,
impl<P> Send for Scheduler<P>where
P: Send,
impl<P> Sync for Scheduler<P>where
P: Sync,
impl<P> Unpin for Scheduler<P>where
P: Unpin,
impl<P> UnsafeUnpin for Scheduler<P>
impl<P> UnwindSafe for Scheduler<P>where
P: UnwindSafe,
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