Skip to main content

build_sparse

Function build_sparse 

Source
pub fn build_sparse(
    tree: &Tree,
    filter: &[PathBuf],
) -> Result<(Vec<TreeEntry>, SparseManifest, SparseProof), SparseError>
Expand description

Build a sparse manifest from a tree and a filter.

Walks tree.entries in canonical order (which, per SPEC-OBJECTS §4, is byte-wise lex order on name). For each entry, sets bit i in the underlying MerkleizedBitMap iff any prefix in filter selects that entry’s name.

Returns

  • the subset of tree.entries selected by the filter (the ones the server would actually ship under a server-side sparse delivery), in the same canonical order;
  • the SparseManifest committing to that subset;
  • the SparseProof the verifier needs to check the manifest.

§Errors

§Panics

Never panics on caller input. May abort the in-process commonware async runtime on an upstream bug; we treat that as a programmer error because the bitmap is in-memory only and has no real I/O paths to fail on.