pub struct BaoTree { /* private fields */ }
Expand description
Defines a Bao tree.
This is just the specification of the tree, it does not contain any actual data.
Implementations§
source§impl BaoTree
impl BaoTree
sourcepub fn empty(block_size: BlockSize) -> Self
pub fn empty(block_size: BlockSize) -> Self
Create a new empty BaoTree with the given block size
sourcepub fn size(&self) -> ByteNum
pub fn size(&self) -> ByteNum
The size of the blob from which this tree was constructed, in bytes
sourcepub fn post_order_chunks_iter(&self) -> PostOrderChunkIter ⓘ
pub fn post_order_chunks_iter(&self) -> PostOrderChunkIter ⓘ
Traverse the entire tree in post order as BaoChunks
This iterator is used by both the sync and async io code for computing an outboard from existing data
sourcepub fn ranges_pre_order_chunks_iter_ref<'a>(
&self,
ranges: &'a RangeSetRef<ChunkNum>,
min_level: u8
) -> PreOrderChunkIterRef<'a> ⓘ
pub fn ranges_pre_order_chunks_iter_ref<'a>( &self, ranges: &'a RangeSetRef<ChunkNum>, min_level: u8 ) -> PreOrderChunkIterRef<'a> ⓘ
Traverse the part of the tree that is relevant for a ranges querys in pre order as BaoChunks
This iterator is used by both the sync and async io code for encoding from an outboard and ranges as well as decoding an encoded stream.
sourcepub fn post_order_nodes_iter(&self) -> PostOrderNodeIter ⓘ
pub fn post_order_nodes_iter(&self) -> PostOrderNodeIter ⓘ
Traverse the entire tree in post order as TreeNodes
This is mostly used internally by the PostOrderChunkIter
sourcepub fn pre_order_nodes_iter(&self) -> PreOrderNodeIter ⓘ
pub fn pre_order_nodes_iter(&self) -> PreOrderNodeIter ⓘ
Traverse the entire tree in pre order as TreeNodes
sourcepub fn ranges_pre_order_nodes_iter<'a>(
&self,
ranges: &'a RangeSetRef<ChunkNum>,
min_level: u8
) -> PreOrderPartialIterRef<'a> ⓘ
pub fn ranges_pre_order_nodes_iter<'a>( &self, ranges: &'a RangeSetRef<ChunkNum>, min_level: u8 ) -> PreOrderPartialIterRef<'a> ⓘ
Traverse the part of the tree that is relevant for a ranges querys in pre order as NodeInfos
This is mostly used internally by the PreOrderChunkIterRef
sourcepub fn new_with_start_chunk(
size: ByteNum,
block_size: BlockSize,
start_chunk: ChunkNum
) -> Self
pub fn new_with_start_chunk( size: ByteNum, block_size: BlockSize, start_chunk: ChunkNum ) -> Self
Create a new BaoTree with a start chunk
This is used for trees that are part of a larger file. The start chunk is the chunk number of the first chunk in the tree.
This is mostly used internally.
sourcepub fn blocks(&self) -> BlockNum
pub fn blocks(&self) -> BlockNum
Number of blocks in the tree
At chunk group size 1, this is the same as the number of chunks Even a tree with 0 bytes size has a single block
sourcepub const fn chunk_num(&self, node: LeafNode) -> ChunkNum
pub const fn chunk_num(&self, node: LeafNode) -> ChunkNum
Given a leaf node of this tree, return its start chunk number
sourcepub fn pre_order_offset(&self, node: TreeNode) -> Option<u64>
pub fn pre_order_offset(&self, node: TreeNode) -> Option<u64>
The offset of the given node in the pre order traversal
sourcepub fn post_order_offset(&self, node: TreeNode) -> Option<PostOrderOffset>
pub fn post_order_offset(&self, node: TreeNode) -> Option<PostOrderOffset>
The offset of the given node in the post order traversal