Trait opendal::raw::oio::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<()>> + 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<()>> + MaybeSend

Append the data to the end of this object.

Object Safety§

This trait is not object safe.

Implementors§