pub struct FileDiff {Show 20 fields
pub path: String,
pub action: DiffAction,
pub source_info: Option<FileMetadata>,
pub target_info: Option<FileMetadata>,
pub change_details: ChangeDetails,
pub size_diff: i64,
pub is_large_file: bool,
pub requires_chunking: bool,
pub requires_encryption: bool,
pub priority: u8,
pub estimated_duration_ms: u64,
pub last_processed: Option<SystemTime>,
pub retry_count: u32,
pub error_message: Option<String>,
pub tags: Vec<String>,
pub checksum_type: ChecksumType,
pub source_checksum: Option<String>,
pub target_checksum: Option<String>,
pub diff_id: String,
pub created_at: SystemTime,
}Expand description
文件差异详情
Fields§
§path: String相对路径(相对于同步根目录)
action: DiffAction差异操作类型
source_info: Option<FileMetadata>源文件信息(如果存在)
target_info: Option<FileMetadata>目标文件信息(如果存在)
change_details: ChangeDetails变化详情
size_diff: i64文件大小差异(字节)
is_large_file: bool是否为大文件(超过阈值)
requires_chunking: bool是否需要分块传输
requires_encryption: bool是否需要加密
priority: u8优先级(0-100,越高越先处理)
estimated_duration_ms: u64预计传输时间(毫秒)
last_processed: Option<SystemTime>上次处理时间
retry_count: u32重试次数
error_message: Option<String>错误信息(如果之前处理失败)
自定义标签
checksum_type: ChecksumType校验和类型
source_checksum: Option<String>源文件校验和
target_checksum: Option<String>目标文件校验和
diff_id: String差异ID(用于去重和跟踪)
created_at: SystemTime创建时间
Implementations§
Source§impl FileDiff
impl FileDiff
pub fn new( path: String, action: DiffAction, source_info: Option<FileMetadata>, target_info: Option<FileMetadata>, ) -> Self
pub fn upload( path: String, source_info: FileMetadata, target_info: Option<FileMetadata>, ) -> Self
pub fn download( path: String, target_info: FileMetadata, source_info: Option<FileMetadata>, ) -> Self
pub fn delete(path: String, target_info: FileMetadata) -> Self
pub fn conflict( path: String, source_info: FileMetadata, target_info: FileMetadata, ) -> Self
pub fn update( path: String, source_info: FileMetadata, target_info: FileMetadata, ) -> Self
pub fn unchanged( path: String, source_info: FileMetadata, target_info: FileMetadata, ) -> Self
pub fn create_dir(path: String, source_info: FileMetadata) -> Self
pub fn move_file( from: String, to: String, source_info: FileMetadata, target_info: FileMetadata, ) -> Self
pub fn calculate_similarity(&self) -> f64
pub fn is_similar(&self, threshold: f64) -> bool
pub fn should_retry(&self, max_retries: u32) -> bool
pub fn mark_retry(&mut self, error: Option<String>)
pub fn mark_success(&mut self)
pub fn is_expired(&self, timeout: Duration) -> bool
pub fn total_size(&self) -> u64
pub fn transfer_size(&self) -> u64
pub fn human_readable_size(&self) -> String
pub fn summary(&self) -> String
pub fn to_json(&self) -> Result<String>
pub fn from_json(json: &str) -> Result<Self>
pub fn is_encrypted(&self) -> bool
pub fn requires_decryption(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileDiff
impl<'de> Deserialize<'de> for FileDiff
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 FileDiff
impl RefUnwindSafe for FileDiff
impl Send for FileDiff
impl Sync for FileDiff
impl Unpin for FileDiff
impl UnwindSafe for FileDiff
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