Skip to content

Record CRDT

Jesse Gibson edited this page Dec 25, 2019 · 1 revision

Record

Composes the Register into a structure of predefined fields enforced by the type system.

Structure

{
  id: string,
  fields: {
    [string]: Register,
  },
}

The merge function accepts another record, applying the merge function on each register for all fields.

Record IDs should always be prefixed with the number 1.

Methods

The record exposes a single mutation: .update(). For all fields, it calls .set(...) on the corresponding register.

Delta tracking

To produce a map delta, find all registers which report a change, adding them to a new map of the same ID. The product is the minimal delta.

Clone this wiki locally