Trait AppendWrite

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

AppendWrite is used to implement oio::Write based on append object. By implementing AppendWrite, services don’t need to care about the details of buffering and uploading parts.

The layout after adopting AppendWrite:

  • Services impl AppendWrite
  • AppendWriter impl Write
  • Expose AppendWriter as Accessor::Writer

§Requirements

Services that implement AppendWrite must fulfill the following requirements:

  • Must be a http service that could accept AsyncBody.
  • Provide a way to get the current offset of the append object.

Required Methods§

Source

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

Get the current offset of the append object.

Returns 0 if the object is not exist.

Source

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

Append the data to the end of this object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§