Skip to main content

ResumableUploadManager

Struct ResumableUploadManager 

Source
pub struct ResumableUploadManager { /* private fields */ }
Expand description

断点续传管理器:持久化分片上传状态,支持中断后恢复

Implementations§

Source§

impl ResumableUploadManager

Source

pub fn new() -> Self

Source

pub fn initiate( &self, key: &str, content_type: &str, total_size: usize, part_size: usize, ) -> Result<String, StorageError>

发起分片上传

Source

pub fn upload_part( &self, upload_id: &str, number: u32, data: Vec<u8>, ) -> Result<String, StorageError>

上传单个分片

Source

pub fn complete(&self, upload_id: &str) -> Result<Vec<u8>, StorageError>

完成上传

Source

pub fn abort(&self, upload_id: &str) -> Result<(), StorageError>

中止上传

Source

pub fn get_session(&self, upload_id: &str) -> Option<MultipartUploadSnapshot>

获取上传会话状态(用于断点续传查询已上传分片)

Source

pub fn list_uploads(&self) -> Vec<String>

列出所有活跃的上传会话 ID(不包含已完成或已中止的)

Source

pub fn get_completed_data(&self, key: &str) -> Option<Vec<u8>>

获取已完成上传的数据

Source

pub fn cleanup(&self) -> usize

清理已完成或已中止的会话

Trait Implementations§

Source§

impl Default for ResumableUploadManager

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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, 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.