pub struct PartialTransferManager { /* private fields */ }Expand description
Manager for partial message transfers
Implementations§
Source§impl PartialTransferManager
impl PartialTransferManager
Sourcepub fn with_config(config: TransferConfig) -> Self
pub fn with_config(config: TransferConfig) -> Self
Create a new transfer manager with custom configuration
Sourcepub async fn start_transfer(&self, total_bytes: usize) -> Result<TransferId>
pub async fn start_transfer(&self, total_bytes: usize) -> Result<TransferId>
Sourcepub async fn update_progress(
&self,
id: TransferId,
bytes_transferred: usize,
chunk_index: usize,
) -> Result<()>
pub async fn update_progress( &self, id: TransferId, bytes_transferred: usize, chunk_index: usize, ) -> Result<()>
Update transfer progress
§Arguments
id- Transfer IDbytes_transferred- Total bytes transferred so farchunk_index- Current chunk index
Sourcepub async fn complete_transfer(&self, id: TransferId) -> Result<()>
pub async fn complete_transfer(&self, id: TransferId) -> Result<()>
Mark transfer as completed
Sourcepub async fn interrupt_transfer(&self, id: TransferId) -> Result<()>
pub async fn interrupt_transfer(&self, id: TransferId) -> Result<()>
Interrupt transfer (can be resumed if configured)
Sourcepub async fn resume_transfer(&self, id: TransferId) -> Result<usize>
pub async fn resume_transfer(&self, id: TransferId) -> Result<usize>
Resume an interrupted transfer
Sourcepub async fn fail_transfer(&self, id: TransferId, error: String) -> Result<()>
pub async fn fail_transfer(&self, id: TransferId, error: String) -> Result<()>
Fail a transfer with error message
Sourcepub async fn get_transfer(&self, id: TransferId) -> Option<TransferInfo>
pub async fn get_transfer(&self, id: TransferId) -> Option<TransferInfo>
Get transfer information
Sourcepub async fn active_transfers(&self) -> Vec<TransferInfo>
pub async fn active_transfers(&self) -> Vec<TransferInfo>
Get all active transfers
Sourcepub async fn cleanup_completed(&self)
pub async fn cleanup_completed(&self)
Remove completed or failed transfers
Sourcepub async fn cleanup_timed_out(&self)
pub async fn cleanup_timed_out(&self)
Remove transfers that have timed out
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PartialTransferManager
impl !RefUnwindSafe for PartialTransferManager
impl Send for PartialTransferManager
impl Sync for PartialTransferManager
impl Unpin for PartialTransferManager
impl !UnwindSafe for PartialTransferManager
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