Skip to main content

PartSink

Trait PartSink 

Source
pub trait PartSink: Send {
    // Required methods
    fn part_size(&self) -> usize;
    fn send_part<'life0, 'async_trait>(
        &'life0 mut self,
        part: Bytes,
        offset: u64,
        is_last: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn abort<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn finish<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

The one per-provider streaming-upload surface: a session that accepts ordered parts and commits. The central [write_blob] driver opens one of these for a large blob and pumps BlobBody parts into it — no backend writes its own upload loop, collect, or progress call.

Required Methods§

Source

fn part_size(&self) -> usize

Bytes per part. Every part except the last is exactly this; the last is the remainder. Encodes each provider’s required part size (S3 ≥ 5 MiB, OneDrive 320 KiB multiples, Drive 256 KiB multiples, …).

Source

fn send_part<'life0, 'async_trait>( &'life0 mut self, part: Bytes, offset: u64, is_last: bool, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Send one part. offset is its byte offset in the blob; is_last marks the final part (providers that commit on the last call use it).

Source

fn abort<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Cancel the open upload and remove its unpublished provider state. The upload owner awaits this operation and returns any cleanup failure to its caller; Drop must never block or terminate the process.

Source

fn finish<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait,

Commit the upload (e.g. S3 complete_multipart_upload); a no-op where the last send_part already committed.

Implementors§