pub trait JoinMode: Sized + 'static {
type RootRef: Clone + Debug + Send + Sync;
type JoinerContext: Clone + Debug + Send + Sync;
const REF_SIZE: usize;
// Required methods
fn root_address(input: &Self::RootRef) -> ChunkAddress;
fn init_from_chunk<const BS: usize>(
input: Self::RootRef,
chunk: ContentChunk<BS>,
) -> Result<(ChunkAddress, u64, Self::JoinerContext)>;
fn decode_body<const BS: usize>(
chunk: ContentChunk<BS>,
context: &Self::JoinerContext,
span: u64,
) -> Result<Bytes>;
fn parse_child_ref(
body: &[u8],
ref_start: usize,
) -> Result<(ChunkAddress, Self::JoinerContext)>;
// Provided methods
fn refs_per_chunk(body_size: usize) -> usize { ... }
fn levels(length: u64, chunk_size: usize) -> usize { ... }
fn subspan_size<const BS: usize>(span: u64) -> u64 { ... }
fn child_span<const BS: usize>(
parent_span: u64,
subspan: u64,
child_index: usize,
) -> u64 { ... }
}Expand description
Joiner-side chunk mode operations.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn root_address(input: &Self::RootRef) -> ChunkAddress
fn root_address(input: &Self::RootRef) -> ChunkAddress
Extract the chunk address from a root reference (for fetching).
Sourcefn init_from_chunk<const BS: usize>(
input: Self::RootRef,
chunk: ContentChunk<BS>,
) -> Result<(ChunkAddress, u64, Self::JoinerContext)>
fn init_from_chunk<const BS: usize>( input: Self::RootRef, chunk: ContentChunk<BS>, ) -> Result<(ChunkAddress, u64, Self::JoinerContext)>
Initialize joiner from a root ref and pre-fetched root chunk.
Sourcefn decode_body<const BS: usize>(
chunk: ContentChunk<BS>,
context: &Self::JoinerContext,
span: u64,
) -> Result<Bytes>
fn decode_body<const BS: usize>( chunk: ContentChunk<BS>, context: &Self::JoinerContext, span: u64, ) -> Result<Bytes>
Decode a fetched chunk into body bytes (decrypting if needed).
Sourcefn parse_child_ref(
body: &[u8],
ref_start: usize,
) -> Result<(ChunkAddress, Self::JoinerContext)>
fn parse_child_ref( body: &[u8], ref_start: usize, ) -> Result<(ChunkAddress, Self::JoinerContext)>
Parse a child reference from body bytes at offset. Returns (address, child_context).
Provided Methods§
Sourcefn refs_per_chunk(body_size: usize) -> usize
fn refs_per_chunk(body_size: usize) -> usize
Number of child references per intermediate chunk.
Sourcefn subspan_size<const BS: usize>(span: u64) -> u64
fn subspan_size<const BS: usize>(span: u64) -> u64
Subspan size for a given parent span.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".