pub struct Scheduler { /* private fields */ }Expand description
Download scheduler
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(config: SchedulerConfig) -> Self
pub fn new(config: SchedulerConfig) -> Self
Create a new scheduler
Sourcepub fn enqueue(&self, fragment: PrioritizedFragment)
pub fn enqueue(&self, fragment: PrioritizedFragment)
Enqueue a fragment for download
Sourcepub fn enqueue_many(
&self,
fragments: impl IntoIterator<Item = PrioritizedFragment>,
)
pub fn enqueue_many( &self, fragments: impl IntoIterator<Item = PrioritizedFragment>, )
Enqueue multiple fragments
Sourcepub async fn next(&self) -> Option<(PrioritizedFragment, SchedulerPermit<'_>)>
pub async fn next(&self) -> Option<(PrioritizedFragment, SchedulerPermit<'_>)>
Get next fragment to download
Sourcepub async fn record_success(&self, bytes: u64, duration: Duration)
pub async fn record_success(&self, bytes: u64, duration: Duration)
Record completed download
Sourcepub fn record_failure(&self)
pub fn record_failure(&self)
Record failed download
Sourcepub fn bandwidth(&self) -> &BandwidthMonitor
pub fn bandwidth(&self) -> &BandwidthMonitor
Get bandwidth monitor
Sourcepub async fn should_throttle(&self) -> bool
pub async fn should_throttle(&self) -> bool
Check if should reduce concurrency (bandwidth dropping)
Sourcepub fn update_priority(&self, fragment_id: &FragmentId, priority: Priority)
pub fn update_priority(&self, fragment_id: &FragmentId, priority: Priority)
Update priority of queued fragment
Auto Trait Implementations§
impl !Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl !UnwindSafe for Scheduler
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