pub struct SuffixBag { /* private fields */ }Expand description
Contiguous storage for key suffixes.
Implementations§
Source§impl SuffixBag
impl SuffixBag
Sourcepub fn compact_with_permuter<P: PermutationProvider>(
&mut self,
perm: &P,
exclude_slot: Option<usize>,
) -> usize
pub fn compact_with_permuter<P: PermutationProvider>( &mut self, perm: &P, exclude_slot: Option<usize>, ) -> usize
Source§impl SuffixBag
impl SuffixBag
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new suffix bag with specified capacity.
Sourcepub fn try_assign(&mut self, slot: usize, suffix: &[u8]) -> bool
pub fn try_assign(&mut self, slot: usize, suffix: &[u8]) -> bool
Assign a suffix with smart space management.
§Panics
Panics if suffix.len() > u16::MAX (65535 bytes).
Sourcepub fn has_suffix(&self, slot: usize) -> bool
pub fn has_suffix(&self, slot: usize) -> bool
Sourcepub fn get_or_empty(&self, slot: usize) -> &[u8] ⓘ
pub fn get_or_empty(&self, slot: usize) -> &[u8] ⓘ
Sourcepub fn try_assign_append_only(&mut self, slot: usize, suffix: &[u8]) -> bool
pub fn try_assign_append_only(&mut self, slot: usize, suffix: &[u8]) -> bool
Append-only suffix assignment for concurrent use.
Unlike try_assign_in_place, this method
never overwrites existing suffix bytes. New data is always appended to
the end of the buffer, so concurrent OCC readers reading old offsets
see stable data. Old suffix space becomes dead until drain-and-rebuild.
§Panics
Panics if slot >= 15 or if suffix length exceeds u16::MAX.
Sourcepub fn try_assign_in_place(&mut self, slot: usize, suffix: &[u8]) -> bool
pub fn try_assign_in_place(&mut self, slot: usize, suffix: &[u8]) -> bool
Try to assign a suffix to a slot in-place, without growing the buffer.
This method may overwrite existing suffix bytes in-place when the new
suffix fits. It is NOT safe for concurrent use (readers may observe
partially-written data). Use try_assign_append_only
for the concurrent path.
§Panics
Panics if slot >= 15 or if suffix length exceeds u16::MAX.
Sourcepub fn suffix_equals(&self, slot: usize, suffix: &[u8]) -> bool
pub fn suffix_equals(&self, slot: usize, suffix: &[u8]) -> bool
Check if a slot’s suffix equals the given suffix.