pub struct MultipartUpload {
pub upload_id: String,
pub key: String,
pub content_type: String,
pub parts: Vec<Part>,
pub expected_parts: u32,
pub part_size: usize,
pub status: UploadStatus,
pub created_at: u64,
}Expand description
分片上传会话
Fields§
§upload_id: String上传 ID
key: String目标对象 key
content_type: StringContent-Type
parts: Vec<Part>已上传的分片列表
expected_parts: u32预期的总分片数
part_size: usize每个分片的大小阈值(字节)
status: UploadStatus上传状态
created_at: u64创建时间戳(秒)
Implementations§
Source§impl MultipartUpload
impl MultipartUpload
Sourcepub fn new(
key: impl Into<String>,
content_type: impl Into<String>,
part_size: usize,
) -> Self
pub fn new( key: impl Into<String>, content_type: impl Into<String>, part_size: usize, ) -> Self
创建新的分片上传会话
Sourcepub fn upload_part(
&mut self,
number: u32,
data: Vec<u8>,
) -> Result<String, StorageError>
pub fn upload_part( &mut self, number: u32, data: Vec<u8>, ) -> Result<String, StorageError>
上传一个分片
Sourcepub fn abort(&mut self) -> Result<(), StorageError>
pub fn abort(&mut self) -> Result<(), StorageError>
中止分片上传
Sourcepub fn uploaded_part_count(&self) -> usize
pub fn uploaded_part_count(&self) -> usize
返回已上传分片数量
Sourcepub fn uploaded_bytes(&self) -> usize
pub fn uploaded_bytes(&self) -> usize
返回已上传字节数
Sourcepub fn progress_percent(&self) -> u8
pub fn progress_percent(&self) -> u8
返回上传进度百分比(0-100)
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
判断上传是否已完成
Trait Implementations§
Source§impl Debug for MultipartUpload
impl Debug for MultipartUpload
Source§impl<'de> Deserialize<'de> for MultipartUpload
impl<'de> Deserialize<'de> for MultipartUpload
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 MultipartUpload
impl RefUnwindSafe for MultipartUpload
impl Send for MultipartUpload
impl Sync for MultipartUpload
impl Unpin for MultipartUpload
impl UnsafeUnpin for MultipartUpload
impl UnwindSafe for MultipartUpload
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