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.entriesselected by the filter (the ones the server would actually ship under a server-side sparse delivery), in the same canonical order; - the
SparseManifestcommitting to that subset; - the
SparseProofthe verifier needs to check the manifest.
§Errors
SparseError::UnsortedTree—tree.entriesviolates the spec-mandated lex ordering.SparseError::TooManyLeaves—tree.entries.len() > MAX_LEAVES.SparseError::TooManyFilterPaths—filter.len() > MAX_FILTER_PATHS.
§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.