pub trait UploadSink: Send {
// Required methods
fn write<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn commit<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<FileMeta, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait;
fn abort<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn write_at<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_offset: u64,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn received_ranges<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkRange>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Streaming write handle returned by StorageBackend::write_stream.
Data written goes to a temporary location (typically a temp file)
until UploadSink::commit atomically renames it into place; a
failed or aborted upload leaves no partial target behind.
Required Methods§
Sourcefn write<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append buf at the sink’s current position.
Sourcefn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Current length of the destination, for size validation before commit.
Provided Methods§
Sourcefn write_at<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_offset: u64,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_at<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_offset: u64,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write buf at an absolute offset within the destination.
Sequential-only sinks may ignore offset and append instead (the
default). Positional sinks (used by the concurrent “session” upload
path) seek to offset first, so out-of-order chunks land in the
right place.
Sourcefn received_ranges<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkRange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn received_ranges<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkRange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The contiguous byte ranges of the destination already received.
Used by the resumable “session” upload path: after an interruption
the client probes the server for the ranges that already landed so it
can retransmit only the missing gaps (BitTorrent-style). Sinks that
do not track received ranges return Ok(vec![]) (the default), which
makes a resume degrade to a full re-send.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".