pub struct Node {
pub keys: Vec<Vec<u8>>,
pub vals: Vec<Vec<u8>>,
pub leaf: bool,
pub level: u8,
pub min_chunk_size: usize,
pub max_chunk_size: usize,
pub chunking_factor: u32,
pub hash_seed: u64,
pub encoding: Encoding,
}Expand description
A node in the Prolly Tree
Fields§
§keys: Vec<Vec<u8>>Keys (sorted, lexicographic byte order)
vals: Vec<Vec<u8>>Values: raw bytes for leaves, CIDs for internal nodes
leaf: boolLeaf node (true) or internal node (false)
level: u8Tree level (0 = leaf level)
min_chunk_size: usizeMinimum entries before considering boundary
max_chunk_size: usizeMaximum entries in a node
chunking_factor: u32Chunking factor (higher = larger nodes)
hash_seed: u64Hash seed for boundary detection
encoding: EncodingValue encoding type
Implementations§
Source§impl Node
impl Node
Sourcepub fn new_internal(level: u8) -> Self
pub fn new_internal(level: u8) -> Self
Create a new internal node at the specified level
Sourcepub fn builder() -> NodeBuilder
pub fn builder() -> NodeBuilder
Create a builder for constructing a Node
Sourcepub fn search(&self, key: &[u8]) -> Result<usize, usize>
pub fn search(&self, key: &[u8]) -> Result<usize, usize>
Binary search for key index Returns Ok(index) if found, Err(index) for insertion point
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Return the exact length of the compact serialized form without allocating it.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, Error>
pub fn from_bytes(data: &[u8]) -> Result<Self, Error>
Deserialize from compact bytes, falling back to legacy CBOR.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Converts
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>
Converts
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