Skip to main content

TransferSnapshot

Struct TransferSnapshot 

Source
pub struct TransferSnapshot {
Show 22 fields pub active: bool, pub direction: TransferDirection, pub current_bytes: u64, pub total_bytes: Option<u64>, pub session_total_bytes: u64, pub session_transferred_bytes: u64, pub completed_total_bytes: u64, pub completed_transferred_bytes: u64, pub instant_bps: f64, pub session_avg_bps: f64, pub session_started_at: Option<f64>, pub session_bytes_done: u64, pub active_item_label: Option<String>, pub active_route: Option<String>, pub last_upload_avg_bps: f64, pub last_download_avg_bps: f64, pub last_tick_at: Option<f64>, pub last_tick_bytes: u64, pub active_uploads: usize, pub active_downloads: usize, pub active_item_bytes: HashMap<String, u64>, pub active_item_totals: HashMap<String, u64>,
}
Expand description

Snapshot describing currently executing and active file transfers.

Fields§

§active: bool

True if a transfer batch session is currently running.

§direction: TransferDirection

Direction of current active transfer session.

§current_bytes: u64

Total bytes processed in current transfer task.

§total_bytes: Option<u64>

Total bytes target across current session.

§session_total_bytes: u64

Estimated sum of all item file sizes in the active batch.

§session_transferred_bytes: u64

Sum of all bytes successfully sent or received in this session.

§completed_total_bytes: u64

Total target bytes of previously finished items in the batch.

§completed_transferred_bytes: u64

Total bytes completed of previously finished items in the batch.

§instant_bps: f64

Instant speed in bytes per second.

§session_avg_bps: f64

Average session speed in bytes per second.

§session_started_at: Option<f64>

Epoch timestamp when the transfer session was started.

§session_bytes_done: u64

Snapshot count of completed session bytes.

§active_item_label: Option<String>

Label representing the file currently being processed.

§active_route: Option<String>

Active network route segment used for connection.

§last_upload_avg_bps: f64

Average bytes per second achieved on the last upload batch.

§last_download_avg_bps: f64

Average bytes per second achieved on the last download batch.

§last_tick_at: Option<f64>

Tick epoch timestamp used to recalculate instant speed.

§last_tick_bytes: u64

Bytes processed on the last instant speed tick check.

§active_uploads: usize

Number of active parallel upload workers.

§active_downloads: usize

Number of active parallel download workers.

§active_item_bytes: HashMap<String, u64>

Track of active item transferred bytes maps.

§active_item_totals: HashMap<String, u64>

Track of active item total sizes maps.

Implementations§

Source§

impl TransferSnapshot

Source

pub fn reset_runtime(&mut self)

Reset active metrics back to zero.

Source

fn should_switch_to(&self, direction: &TransferDirection) -> bool

Check if target transfer direction should be switched.

Source

fn ensure_session( &mut self, direction: TransferDirection, route: Option<String>, )

Ensure an active transfer session group is initialized.

Source

pub fn register_item( &mut self, direction: TransferDirection, item_id: impl Into<String>, total_bytes: Option<u64>, item_label: Option<String>, route: Option<String>, )

Add an active item structure into the ongoing transfer snapshot.

Source

pub fn begin_group( &mut self, direction: TransferDirection, item_label: Option<String>, route: Option<String>, )

Start tracking a group of transfer operations.

Source

pub fn update_item_total(&mut self, item_id: &str, total_bytes: u64)

Update total sizes for a specific active item in the transfer.

Source

pub fn update_item_bytes( &mut self, direction: TransferDirection, item_id: &str, bytes_done: u64, route: Option<String>, )

Update bytes completed so far for a specific active item.

Source

pub fn finish_item( &mut self, direction: TransferDirection, item_id: &str, route: Option<String>, ) -> bool

Finish tracking a specific item, returning true if the session is empty.

Trait Implementations§

Source§

impl Clone for TransferSnapshot

Source§

fn clone(&self) -> TransferSnapshot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransferSnapshot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TransferSnapshot

Source§

fn default() -> TransferSnapshot

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TransferSnapshot

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TransferSnapshot

Source§

fn eq(&self, other: &TransferSnapshot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TransferSnapshot

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TransferSnapshot

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, Ctx> BundleDefault<Ctx> for T
where T: Default,

§

fn default_with_context(_: Ctx) -> T

Creates a default value with the given context.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more