Module delta

Module delta 

Source
Expand description

The data patch: what a Mode B subscription carries instead of DOM patches.

docs/05-tier-lowering.md §5.1’s table has one row that decides the whole mode — “Wire carries: DOM patches | data patches (state diffs)”. crate::diff is the first half — the DOM patch — and this is the second.

§Why a diff rather than the value

Sending the accumulator on every event would make each event cost the size of the state rather than the size of the change, which is the asymptote docs/24-incremental-views-report.md spent a whole report removing from the view path. A card moved on a thousand-card board is one Op::Put, and it stays one as the board grows: cost per event is a function of the change, not of the collection.

§Paths

A Path is how to get from the root of the accumulator to the value that changed — a field of a record, an index of a list, a key of a map. Records and maps are addressed by name and by key, so an op stays applicable when its neighbours move; only a list is addressed by position, which is why the list rules below are the conservative ones.

§What this is not

It is not a merge. Ops are produced by one writer against a state the reader has, and applied in order at a known seq — the same discipline the DOM patch stream already has (§4.4). Two writers would need docs/10-decisions.md D7’s CRDT-valued types, which are v1.x and are not this.

Structs§

BadPatch
Why a patch could not be applied.

Enums§

Op
One change to the state a client holds.
Step
One step from a value to a value inside it.

Functions§

apply
Apply a patch, in order.
diff
The ops that turn old into new.

Type Aliases§

Path
Where in the accumulator an op applies.