Expand description
Turning two consecutive trees into the delta between them.
Producing a delta is the mirror of composing one, and it has to agree with
crate::apply_tree_delta exactly: whatever this emits, the driver
applies, and any disagreement shows up as a tree that silently drifts from
the screen.
Two rules here are easy to get wrong and both are load-bearing:
- a node that survives under a parent being removed must be re-sent in
changed, even when nothing about it changed, because the removal cascades through it first; rootIdsmust be sent whenever the inherited list — the base’s roots minus whatever the removals took — is not the list the new tree wants.
Constants§
- DELTA_
SHARE_ CEILING - The point past which a delta stops paying for itself: beyond roughly half the tree, the whole snapshot is cheaper to send and far cheaper to reason about.
Functions§
- build_
delta - Build the
tree-deltabody, orNonewhen a whole snapshot is the better answer. - diff_
trees - Report what changed, what was removed, the root list when it can no longer be inherited, and whether the cursor moved.