pub async fn tree_diff<S: Store>(
tree: &HashTree<S>,
old_root: Option<&Cid>,
new_root: &Cid,
concurrency: usize,
) -> Result<TreeDiff, HashTreeError>Expand description
Compute diff between two trees
Returns hashes present in new_root but not in old_root.
Uses subtree pruning: when a hash exists in old tree, skips entire subtree.
§Algorithm
- Collect all hashes from old tree into a set
- Walk new tree:
- If hash in old set: skip (subtree unchanged)
- If hash not in old set: add to result, traverse children
§Arguments
tree- HashTree instanceold_root- Root of the old tree (may be None for first push)new_root- Root of the new treeconcurrency- Number of concurrent fetches
§Returns
TreeDiff with added hashes and statistics