Skip to main content

AppendWrite

Trait AppendWrite 

pub trait AppendWrite:
    Send
    + Sync
    + Unpin
    + 'static {
    // Required methods
    fn offset(&self) -> impl Future<Output = Result<u64, Error>> + MaybeSend;
    fn append(
        &self,
        offset: u64,
        size: u64,
        body: Buffer,
    ) -> impl Future<Output = Result<Metadata, Error>> + MaybeSend;
}
Expand description

Defines the storage operations that AppendWriter needs to append to an object.

Services using HTTP or any other protocol can implement this trait by retrieving the current end of the object and appending a Buffer there.

Required Methods§

fn offset(&self) -> impl Future<Output = Result<u64, Error>> + MaybeSend

Return the current end of the object as a byte offset.

Return 0 if the object does not exist.

fn append( &self, offset: u64, size: u64, body: Buffer, ) -> impl Future<Output = Result<Metadata, Error>> + MaybeSend

Append size bytes from body to the end of the object and return its metadata.

offset is the expected byte offset at the end of the object.

AppendWriter also calls this method with size 0 and an empty body when a write closes without data, so implementations must create the object and return its metadata for an empty append.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§