Skip to main content

pack_tree_pooled

Function pack_tree_pooled 

Source
pub fn pack_tree_pooled<I>(
    pool: &BufferPool,
    tree_id: u16,
    sorted: I,
    fill: f32,
    scratch_dir: &Path,
) -> Result<(u32, u64)>
where I: Iterator<Item = Result<(Vec<u8>, Vec<u8>, bool)>>,
Expand description

Pack a complete sorted tree through the ORDINARY buffer pool.

Same bottom-up pack as pack_tree, but every page is an ordinary pooled page, so a page-WAL database logs each one as a normal frame and publishes the whole tree with the caller’s commit (PageSink::Pooled). There is no root swap, no skipped log and no second durability rule: Law 3 and Law 5 hold exactly as they do for a single insert, and a crash before the caller’s commit leaves nothing reachable.

This is what a per-index tree is built with: the tree is EMPTY, so there is no standing content to graft beside and no boundary to plan – the packed root simply becomes the index descriptor’s root in the same transaction. Returns (root, rows); an empty stream returns (0, 0), the descriptor’s encoding of an empty tree.