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§
Sourcefn source_metadata(
&self,
) -> impl Future<Output = Result<Metadata, Error>> + MaybeSend
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.
Sourcefn copy_once(&self) -> impl Future<Output = Result<(), Error>> + MaybeSend
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.
Sourcefn copy_block(
&self,
block_id: Uuid,
range: BytesRange,
) -> impl Future<Output = Result<(), Error>> + MaybeSend
fn copy_block( &self, block_id: Uuid, range: BytesRange, ) -> impl Future<Output = Result<(), Error>> + MaybeSend
copy_block copies one source range into one block.
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.