Skip to main content

Module delta

Module delta 

Source
Expand description

Delta operations: encoding, parsing, application, and diffing.

See docs/PROTOCOL.md § “Tree deltas”. Five operations:

OpWire
Add+<ref>@<parent>[:<pos>] <role> <label> ...
Remove-<ref>
Update~<ref> <k>=<v> ...
Move><ref>@<parent>[:<pos>]
Replace*<ref> then indented subtree

The wire encoding is canonical (attributes sorted, ops in source order); the parser is tolerant.

Enums§

DeltaOp
One delta operation.

Functions§

apply
Apply ops to a clone of prev and return the resulting tree.
diff
Compute a delta that transforms a into b. apply(a, diff(a, b)) equals b (modulo position resolution; see the property tests).
encode
Encode a sequence of delta ops as the wire body.
parse
Parse a delta-op stream into a vector of ops.