FileSyncResult

Struct FileSyncResult 

Source
pub struct FileSyncResult {
Show 25 fields pub path: String, pub status: FileSyncStatus, pub size: u64, pub transferred_size: u64, pub source_hash: Option<String>, pub target_hash: Option<String>, pub operation: FileOperation, pub start_time: Option<DateTime<Utc>>, pub end_time: Option<DateTime<Utc>>, pub duration_ms: Option<u64>, pub transfer_speed: Option<f64>, pub retry_count: u32, pub encrypted: bool, pub chunked: bool, pub chunk_count: Option<usize>, pub checksum_verified: Option<bool>, pub error: Option<String>, pub warnings: Vec<String>, pub metadata: Value, pub operation_id: String, pub source_path: Option<String>, pub target_path: String, pub file_type: FileType, pub permissions: Option<u32>, pub modified_time: Option<DateTime<Utc>>,
}
Expand description

文件同步结果

Fields§

§path: String

文件路径

§status: FileSyncStatus

文件状态

§size: u64

文件大小(字节)

§transferred_size: u64

传输大小(实际传输的字节数,可能包括加密开销)

§source_hash: Option<String>

源文件哈希

§target_hash: Option<String>

目标文件哈希

§operation: FileOperation

文件同步操作

§start_time: Option<DateTime<Utc>>

开始时间

§end_time: Option<DateTime<Utc>>

结束时间

§duration_ms: Option<u64>

传输耗时(毫秒)

§transfer_speed: Option<f64>

传输速度(字节/秒)

§retry_count: u32

重试次数

§encrypted: bool

是否加密传输

§chunked: bool

是否分块传输

§chunk_count: Option<usize>

分块数量

§checksum_verified: Option<bool>

校验和验证结果

§error: Option<String>

错误信息(如果有)

§warnings: Vec<String>

警告信息

§metadata: Value

自定义元数据

§operation_id: String

操作ID(用于去重和跟踪)

§source_path: Option<String>

源文件路径(可能不同)

§target_path: String

目标文件路径

§file_type: FileType

文件类型

§permissions: Option<u32>

文件权限

§modified_time: Option<DateTime<Utc>>

文件修改时间

Implementations§

Source§

impl FileSyncResult

Source

pub fn new(path: String, operation: FileOperation) -> Self

Source

pub fn from_diff(diff: &FileDiff, operation: FileOperation) -> Self

Source

pub fn mark_started(&mut self)

Source

pub fn mark_completed(&mut self, success: bool)

Source

pub fn mark_retry(&mut self, error: Option<String>)

Source

pub fn mark_verifying(&mut self)

Source

pub fn mark_verified(&mut self, verified: bool)

Source

pub fn add_warning(&mut self, warning: String)

Source

pub fn is_success(&self) -> bool

Source

pub fn is_failed(&self) -> bool

Source

pub fn is_completed(&self) -> bool

Source

pub fn duration(&self) -> Option<Duration>

Source

pub fn human_readable_size(&self) -> String

Source

pub fn human_readable_transferred(&self) -> String

Source

pub fn human_readable_speed(&self) -> Option<String>

Source

pub fn summary(&self) -> String

Source

pub fn detailed_info(&self) -> String

Source

pub fn to_json(&self) -> Result<String, Error>

Source

pub fn from_json(json: &str) -> Result<Self, Error>

Trait Implementations§

Source§

impl Debug for FileSyncResult

Source§

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

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

impl<'de> Deserialize<'de> for FileSyncResult

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 Serialize for FileSyncResult

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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