pub struct FastCdc { /* private fields */ }Expand description
FastCDC chunker parameters. Construct with FastCdc::v1 for the
frozen v1 constants; other constructors exist mainly for tests that
exercise the algorithm at smaller sizes.
Implementations§
Source§impl FastCdc
impl FastCdc
Sourcepub const fn v1() -> Self
pub const fn v1() -> Self
Construct the v1 chunker (16 KiB / 64 KiB / 256 KiB,
strict/loose 0x0001_FFFF / 0x0000_7FFF).
Sourcepub fn custom(min: usize, avg: usize, max: usize) -> Self
pub fn custom(min: usize, avg: usize, max: usize) -> Self
Construct a chunker with custom parameters. avg_size MUST be a
power of two; the strict/loose masks are derived as
mask = (1 << log2(avg)) - 1; mask_s = mask | (mask << 1); mask_l = mask >> 1.
Returns MkitError::InvalidIdentity re-purposed as a generic
“bad parameter” error if the constraints are violated — but in
practice this constructor is only used by tests, where the inputs
are constants, so we panic instead for a clearer failure mode.
§Panics
Panics if min < avg < max is not strictly satisfied or avg is
not a power of two.
pub const fn min_size(&self) -> usize
pub const fn avg_size(&self) -> usize
pub const fn max_size(&self) -> usize
Sourcepub fn cut(&self, data: &[u8]) -> usize
pub fn cut(&self, data: &[u8]) -> usize
Find the cut point in data. Returns the length of the first
chunk. Semantics:
data.len() <= min_size→ returnsdata.len()(no early cut).min_size < i <= avg_size→ strict mask, fewer boundaries.avg_size < i <= max_size→ loose mask, more boundaries.- Otherwise → forced cut at
min(max_size, data.len()).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FastCdc
impl RefUnwindSafe for FastCdc
impl Send for FastCdc
impl Sync for FastCdc
impl Unpin for FastCdc
impl UnsafeUnpin for FastCdc
impl UnwindSafe for FastCdc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more