pub struct UploadState {
pub upload_id: String,
pub target: String,
pub source: Option<String>,
pub total_size: u64,
pub part_size: u64,
pub completed_parts: Vec<CompletedPart>,
pub last_updated: Timestamp,
}Expand description
State of a multipart upload (for resume)
Fields§
§upload_id: StringUpload ID from S3
target: StringTarget path
source: Option<String>Source file path (if local)
total_size: u64Total file size
part_size: u64Part size used
completed_parts: Vec<CompletedPart>Completed parts (part_number, etag)
last_updated: TimestampTimestamp of last update
Implementations§
Source§impl UploadState
impl UploadState
Sourcepub fn new(
upload_id: impl Into<String>,
target: impl Into<String>,
total_size: u64,
part_size: u64,
) -> Self
pub fn new( upload_id: impl Into<String>, target: impl Into<String>, total_size: u64, part_size: u64, ) -> Self
Create a new upload state
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set source file path
Sourcepub fn add_completed_part(&mut self, part_number: i32, etag: String)
pub fn add_completed_part(&mut self, part_number: i32, etag: String)
Add a completed part
Sourcepub fn next_part_number(&self) -> i32
pub fn next_part_number(&self) -> i32
Get the next part number to upload
Sourcepub fn progress_percent(&self) -> f64
pub fn progress_percent(&self) -> f64
Calculate progress percentage
Sourcepub fn state_file_path(state_dir: &Path, upload_id: &str) -> PathBuf
pub fn state_file_path(state_dir: &Path, upload_id: &str) -> PathBuf
State file path for this upload
Trait Implementations§
Source§impl Clone for UploadState
impl Clone for UploadState
Source§fn clone(&self) -> UploadState
fn clone(&self) -> UploadState
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 UploadState
impl Debug for UploadState
Source§impl<'de> Deserialize<'de> for UploadState
impl<'de> Deserialize<'de> for UploadState
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 UploadState
impl RefUnwindSafe for UploadState
impl Send for UploadState
impl Sync for UploadState
impl Unpin for UploadState
impl UnsafeUnpin for UploadState
impl UnwindSafe for UploadState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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 moreCreates a shared type from an unshared type.