BlockCopy

Trait BlockCopy 

Source
pub trait BlockCopy:
    Send
    + Sync
    + Unpin
    + 'static {
    // Required methods
    fn source_metadata(
        &self,
    ) -> impl Future<Output = Result<Metadata, Error>> + MaybeSend;
    fn copy_once(&self) -> impl Future<Output = Result<(), Error>> + MaybeSend;
    fn copy_block(
        &self,
        block_id: Uuid,
        range: BytesRange,
    ) -> impl Future<Output = Result<(), Error>> + MaybeSend;
    fn complete_block(
        &self,
        block_ids: Vec<Uuid>,
    ) -> impl Future<Output = Result<(), Error>> + MaybeSend;
    fn abort_block(
        &self,
        block_ids: Vec<Uuid>,
    ) -> impl Future<Output = Result<(), Error>> + MaybeSend;
}
Expand description

BlockCopy is used to implement oio::Copy based on block copy.

By implementing BlockCopy, services only need to provide service-specific block copy operations. BlockCopier will drive source metadata loading, block id generation, block queue, completion, and abort state.

Required Methods§

Source

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

source_metadata returns source metadata for planning block copy.

BlockCopier will call this API when source content length hint is not provided.

Source

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

copy_once is used to copy the source object at once.

BlockCopier will call this API when the source object can be copied without starting block copy.

Source

fn copy_block( &self, block_id: Uuid, range: BytesRange, ) -> impl Future<Output = Result<(), Error>> + MaybeSend

copy_block copies one source range into one block.

Source

fn complete_block( &self, block_ids: Vec<Uuid>, ) -> impl Future<Output = Result<(), Error>> + MaybeSend

complete_block completes the block copy with the ordered block id list.

Source

fn abort_block( &self, block_ids: Vec<Uuid>, ) -> impl Future<Output = Result<(), Error>> + MaybeSend

abort_block cancels the pending block copy and purges intermediate state.

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§