Skip to main content

SplitMode

Trait SplitMode 

Source
pub trait SplitMode: JoinMode {
    type RefBytes: AsRef<[u8]> + AsMut<[u8]> + Clone + Debug + Send + Sync;

    // Required methods
    fn prepare_chunk<const BS: usize>(
        data: Vec<u8>,
    ) -> Result<(ContentChunk<BS>, Self::RefBytes)>;
    fn process_empty<const BS: usize, S: SyncChunkPut<BS>>(
        store: &S,
    ) -> Result<Self::RootRef>;
    fn extract_root(buffer: &[u8]) -> Result<Self::RootRef>;

    // Provided method
    fn process_chunk<const BS: usize, S: SyncChunkPut<BS>>(
        data: Vec<u8>,
        store: &S,
    ) -> Result<Self::RefBytes> { ... }
}
Expand description

Splitter-side chunk mode operations (extends JoinMode).

Required Associated Types§

Source

type RefBytes: AsRef<[u8]> + AsMut<[u8]> + Clone + Debug + Send + Sync

Fixed-size byte array for a reference: [u8; 32] or [u8; 64].

Required Methods§

Source

fn prepare_chunk<const BS: usize>( data: Vec<u8>, ) -> Result<(ContentChunk<BS>, Self::RefBytes)>

Prepare chunk data (span + body) for storage, returning chunk and reference bytes. Takes ownership of the payload to avoid an extra allocation.

Source

fn process_empty<const BS: usize, S: SyncChunkPut<BS>>( store: &S, ) -> Result<Self::RootRef>

Process empty file, store chunk, return root ref.

Source

fn extract_root(buffer: &[u8]) -> Result<Self::RootRef>

Extract root reference from top of buffer.

Provided Methods§

Source

fn process_chunk<const BS: usize, S: SyncChunkPut<BS>>( data: Vec<u8>, store: &S, ) -> Result<Self::RefBytes>

Process chunk data (span + body), store it, return reference bytes. Takes ownership of the payload to avoid an extra allocation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SplitMode for EncryptedMode

Available on crate feature encryption only.
Source§

impl SplitMode for PlainMode