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: boolTrue if a transfer batch session is currently running.
direction: TransferDirectionDirection of current active transfer session.
current_bytes: u64Total bytes processed in current transfer task.
total_bytes: Option<u64>Total bytes target across current session.
session_total_bytes: u64Estimated sum of all item file sizes in the active batch.
session_transferred_bytes: u64Sum of all bytes successfully sent or received in this session.
completed_total_bytes: u64Total target bytes of previously finished items in the batch.
completed_transferred_bytes: u64Total bytes completed of previously finished items in the batch.
instant_bps: f64Instant speed in bytes per second.
session_avg_bps: f64Average session speed in bytes per second.
session_started_at: Option<f64>Epoch timestamp when the transfer session was started.
session_bytes_done: u64Snapshot 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: f64Average bytes per second achieved on the last upload batch.
last_download_avg_bps: f64Average 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: u64Bytes processed on the last instant speed tick check.
active_uploads: usizeNumber of active parallel upload workers.
active_downloads: usizeNumber 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
impl TransferSnapshot
Sourcepub fn reset_runtime(&mut self)
pub fn reset_runtime(&mut self)
Reset active metrics back to zero.
Sourcefn should_switch_to(&self, direction: &TransferDirection) -> bool
fn should_switch_to(&self, direction: &TransferDirection) -> bool
Check if target transfer direction should be switched.
Sourcefn ensure_session(
&mut self,
direction: TransferDirection,
route: Option<String>,
)
fn ensure_session( &mut self, direction: TransferDirection, route: Option<String>, )
Ensure an active transfer session group is initialized.
Sourcepub fn register_item(
&mut self,
direction: TransferDirection,
item_id: impl Into<String>,
total_bytes: Option<u64>,
item_label: Option<String>,
route: Option<String>,
)
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.
Sourcepub fn begin_group(
&mut self,
direction: TransferDirection,
item_label: Option<String>,
route: Option<String>,
)
pub fn begin_group( &mut self, direction: TransferDirection, item_label: Option<String>, route: Option<String>, )
Start tracking a group of transfer operations.
Sourcepub fn update_item_total(&mut self, item_id: &str, total_bytes: u64)
pub fn update_item_total(&mut self, item_id: &str, total_bytes: u64)
Update total sizes for a specific active item in the transfer.
Sourcepub fn update_item_bytes(
&mut self,
direction: TransferDirection,
item_id: &str,
bytes_done: u64,
route: Option<String>,
)
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.
Sourcepub fn finish_item(
&mut self,
direction: TransferDirection,
item_id: &str,
route: Option<String>,
) -> bool
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
impl Clone for TransferSnapshot
Source§fn clone(&self) -> TransferSnapshot
fn clone(&self) -> TransferSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransferSnapshot
impl Debug for TransferSnapshot
Source§impl Default for TransferSnapshot
impl Default for TransferSnapshot
Source§fn default() -> TransferSnapshot
fn default() -> TransferSnapshot
Source§impl<'de> Deserialize<'de> for TransferSnapshot
impl<'de> Deserialize<'de> for TransferSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TransferSnapshot
impl PartialEq for TransferSnapshot
Source§fn eq(&self, other: &TransferSnapshot) -> bool
fn eq(&self, other: &TransferSnapshot) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TransferSnapshot
impl Serialize for TransferSnapshot
impl StructuralPartialEq for TransferSnapshot
Auto Trait Implementations§
impl Freeze for TransferSnapshot
impl RefUnwindSafe for TransferSnapshot
impl Send for TransferSnapshot
impl Sync for TransferSnapshot
impl Unpin for TransferSnapshot
impl UnsafeUnpin for TransferSnapshot
impl UnwindSafe for TransferSnapshot
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
§impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
§fn default_with_context(_: Ctx) -> T
fn default_with_context(_: Ctx) -> T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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