HandleStrategy

Trait HandleStrategy 

Source
pub trait HandleStrategy<'a>: Send + Sync {
    // Required methods
    fn save_chunk(
        &self,
        chunk_data: &'a [u8],
        chunk_index: usize,
    ) -> impl Future<Output = Result<(), ChunkStrategyError>> + Send;
    fn merge_chunks(
        &self,
    ) -> impl Future<Output = Result<(), ChunkStrategyError>> + Send;
}
Expand description

Trait for handling chunk operations.

Defines the interface for saving and merging file chunks.

Required Methods§

Source

fn save_chunk( &self, chunk_data: &'a [u8], chunk_index: usize, ) -> impl Future<Output = Result<(), ChunkStrategyError>> + Send

Saves a chunk of data.

§Arguments
  • &'a [u8] - The chunk data to save.
  • usize - The chunk index.
§Returns
  • impl Future<Output = ChunkStrategyResult> - Future of the save operation.
Source

fn merge_chunks( &self, ) -> impl Future<Output = Result<(), ChunkStrategyError>> + Send

Merges all chunks into the final file.

§Returns
  • impl Future<Output = ChunkStrategyResult> - Future of the merge operation.

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§

Source§

impl<'a> HandleStrategy<'a> for ChunkStrategy<'a>

Implementation of handle strategy for chunk operations.