pub struct ServerStatSnapshot {
pub host: String,
pub download_speed: u64,
pub single_connection_avg_speed: u64,
pub multi_connection_avg_speed: u64,
pub last_updated: u64,
pub status: u32,
pub counter: u32,
pub last_error_time: Option<u64>,
pub last_error_code: u16,
pub consecutive_failures: u32,
}Expand description
Serializable snapshot of ServerStat for persistence.
This struct contains all the persistent fields of ServerStat in a serde-compatible format (no atomic types). Used for saving and loading server performance statistics across restarts.
§Example
use aria2_core::selector::server_stat::{ServerStat, ServerStatSnapshot};
let stat = ServerStat::new("mirror.example.com");
stat.update_speed(5000, false);
let snapshot = stat.to_snapshot();
let restored = ServerStat::from_snapshot(&snapshot);
assert_eq!(restored.host, stat.host);Fields§
§host: StringServer hostname (e.g., “mirror1.example.com”)
download_speed: u64Current download speed in bytes/sec
single_connection_avg_speed: u64Exponential moving average of single-connection download speed
multi_connection_avg_speed: u64Exponential moving average of multi-connection download speed
last_updated: u64Unix timestamp of last update
status: u32Server status: 0 = OK, 1 = Error
counter: u32Usage counter (number of times this server was selected)
last_error_time: Option<u64>Unix timestamp of last error (None if never failed)
last_error_code: u16HTTP error code of last error (0 if never failed)
consecutive_failures: u32Number of consecutive failures (reset on success)
Trait Implementations§
Source§impl Clone for ServerStatSnapshot
impl Clone for ServerStatSnapshot
Source§fn clone(&self) -> ServerStatSnapshot
fn clone(&self) -> ServerStatSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerStatSnapshot
impl Debug for ServerStatSnapshot
Source§impl<'de> Deserialize<'de> for ServerStatSnapshot
impl<'de> Deserialize<'de> for ServerStatSnapshot
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ServerStatSnapshot
impl RefUnwindSafe for ServerStatSnapshot
impl Send for ServerStatSnapshot
impl Sync for ServerStatSnapshot
impl Unpin for ServerStatSnapshot
impl UnsafeUnpin for ServerStatSnapshot
impl UnwindSafe for ServerStatSnapshot
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