pub struct TransferQueue { /* private fields */ }Expand description
Size-prioritized queue of blobs waiting for their download quota.
Shorter blobs are started first when they fit the remaining budget. This improves time-to-first-content for mixed workloads while leaving the quota accounting unchanged.
Implementations§
Source§impl TransferQueue
impl TransferQueue
pub fn new() -> Self
Sourcepub fn enqueue(&self, item: PendingTransfer) -> bool
pub fn enqueue(&self, item: PendingTransfer) -> bool
Add a transfer unless the same (namespace, hash) is already queued.
Returns true when the item was newly added.
Sourcepub fn pop_fitting(&self, budget: &TransferBudget) -> Option<PendingTransfer>
pub fn pop_fitting(&self, budget: &TransferBudget) -> Option<PendingTransfer>
Remove and return the smallest item that fits the download budget.
Sourcepub fn remove_namespace(&self, namespace: NamespaceId)
pub fn remove_namespace(&self, namespace: NamespaceId)
Drop everything queued for a namespace (e.g. after leaving a folder).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn pending_bytes(&self) -> u64
pub fn snapshot(&self) -> Vec<PendingTransfer>
Trait Implementations§
Source§impl Debug for TransferQueue
impl Debug for TransferQueue
Auto Trait Implementations§
impl !Freeze for TransferQueue
impl RefUnwindSafe for TransferQueue
impl Send for TransferQueue
impl Sync for TransferQueue
impl Unpin for TransferQueue
impl UnsafeUnpin for TransferQueue
impl UnwindSafe for TransferQueue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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