pub struct ActiveTransfer {
pub id: Uuid,
pub class: QoSClass,
pub bytes_total: usize,
pub bytes_sent: Atomic<usize>,
pub can_pause: bool,
pub is_paused: Atomic<bool>,
pub started_at: Instant,
pub paused_at: RwLock<Option<Instant>>,
}Expand description
An active data transfer being tracked by the preemption controller
Fields§
§id: UuidUnique transfer identifier
class: QoSClassQoS class of this transfer
bytes_total: usizeTotal bytes to transfer
bytes_sent: Atomic<usize>Bytes sent so far
can_pause: boolWhether this transfer can be paused
is_paused: Atomic<bool>Whether this transfer is currently paused
started_at: InstantWhen the transfer started
paused_at: RwLock<Option<Instant>>When the transfer was paused (if applicable)
Implementations§
Source§impl ActiveTransfer
impl ActiveTransfer
Sourcepub fn new(
class: QoSClass,
bytes_total: usize,
can_pause: bool,
) -> ActiveTransfer
pub fn new( class: QoSClass, bytes_total: usize, can_pause: bool, ) -> ActiveTransfer
Create a new active transfer
Sourcepub fn bytes_remaining(&self) -> usize
pub fn bytes_remaining(&self) -> usize
Get remaining bytes to transfer
Sourcepub fn record_sent(&self, bytes: usize)
pub fn record_sent(&self, bytes: usize)
Record bytes sent
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if transfer is complete
Sourcepub fn can_be_preempted_by(&self, class: QoSClass) -> bool
pub fn can_be_preempted_by(&self, class: QoSClass) -> bool
Check if this transfer can be preempted by the given class
Sourcepub async fn paused_duration(&self) -> Option<Duration>
pub async fn paused_duration(&self) -> Option<Duration>
Get time spent paused (if currently paused)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ActiveTransfer
impl !RefUnwindSafe for ActiveTransfer
impl Send for ActiveTransfer
impl Sync for ActiveTransfer
impl Unpin for ActiveTransfer
impl UnsafeUnpin for ActiveTransfer
impl !UnwindSafe for ActiveTransfer
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