weave-lens · node
Source declarations, signatures and documentation for node.
Reviewed implementation boundary: The current batching helper rejects multiple operations instead of implementing atomic batch commits. Cache/compaction/retention configuration fields do not establish running background compaction. See /libraries/lens/overview.
Source: sigil/weave/models/lens/src/node.rs. SHA-256: b83181f55b9adeecfeb7649241a7c31291d0150c4aaf6001d626a525622bb340.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
node::NodeType
B-tree node types
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum NodeType {
/// Leaf node containing values
Leaf,
/// Internal node containing child pointers
Internal,
}Source line: 8.
node::Node
B-tree node
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Node {
/// Node type
pub node_type: NodeType,
/// Node level (0 = leaf)
pub level: u32,
/// Keys in sorted order
pub keys: Vec<Key>,
/// Values (only in leaf nodes)
pub values: Option<Vec<Value>>,
/// Child pointers (only in internal nodes)
pub children: Option<Vec<BlockPointer>>
}Source line: 17.
node::Node::new_leaf
Create a new leaf node
pub fn new_leaf() -> Self;Source line: 36.
node::Node::new_internal
Create a new internal node
pub fn new_internal(level: u32) -> Self;Source line: 47.
node::Node::is_full
Check if node is full given the order
pub fn is_full(&self, order: usize) -> bool;Source line: 58.
node::Node::is_underfull
Check if node is underfull (less than half full)
pub fn is_underfull(&self, order: usize) -> bool;Source line: 63.
node::Node::find_position
Find position where key should be inserted
pub fn find_position(&self, key: &Key) -> Result<usize, usize>;Source line: 68.
node::Node::split
Split node at midpoint
pub fn split(&mut self, _order: usize) -> (Key, Node);Source line: 73.
node::Key
Key in the B-tree
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Key(pub Vec<u8>);Source line: 115.
node::Key::new
Create a new key
pub fn new(data: Vec<u8>) -> Self;Source line: 119.
node::Key::as_bytes
Get key data
pub fn as_bytes(&self) -> &[u8];Source line: 124.
node::Value
Value in the B-tree
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Value {
/// Actual data
pub data: Vec<u8>,
/// Optional metadata
pub metadata: Option<ValueMetadata>
}Source line: 151.
node::Value::new
Create a new value
pub fn new(data: Vec<u8>) -> Self;Source line: 161.
node::Value::with_metadata
Create a value with metadata
pub fn with_metadata(data: Vec<u8>, metadata: ValueMetadata) -> Self;Source line: 169.
node::ValueMetadata
Value metadata
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValueMetadata {
/// Timestamp
pub timestamp: u64,
/// Custom tags
pub tags: Vec<String>,
/// Content type
pub content_type: Option<String>
}Source line: 179.
node::BlockPointer
Pointer to a block in the strand
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub struct BlockPointer {
/// Block index in strand
pub index: u64,
/// Cached minimum key (for optimization)
pub min_key_hash: Option<u64>,
/// Cached maximum key (for optimization)
pub max_key_hash: Option<u64>
}Source line: 192.
node::BlockPointer::new
Create a new block pointer
pub fn new(index: u64) -> Self;Source line: 205.
node::BlockPointer::with_range
Create with key range hints
pub fn with_range(index: u64, min_hash: u64, max_hash: u64) -> Self;Source line: 214.