Back to Loro

Glossary

docs/Glossary.md

0.6.05.5 KB
Original Source

Glossary

NameMeaningNote
DAGDirected Acyclic GraphThe changes in Loro form a DAG. The relationship is expressed by deps field.
RLERun Length EncodingWe not only use it on the encoding, but also in the vec and tree.
ChangeA merged batch of ops
FrontiersThe DAG nodes that no one has dependencies on themThey can be represented by a series of id
OpOperation
State (of a Container)TheIn the code, the state most refers to the visible state to users. For example, the text string of a text container, the key value pairs in the map container
Effect (of an Op)How the op affect the stateWe use CRDT to calculate the effect (obviously)
TrackerA special data structure to calculate the effects
ContainerA unit of CRDT data structure
ContentContent of an Op
IDA global unit id for an OpIt has the structure of {clientId, counter}
CounterThe second field inside ID
LamportLamport timestamp
SpanA series of continuous things
Causal OrderThe order of happen-before relationshipThe DAG expresses the causal order of the changes
VVVersion VectorIn code, it has exclusive end, VV {0: 8} means the last op id of client 0 is 0-7

RLE

We not only use RLE on the encoding, but also in the vec and tree.

i.e. the elements can be merged, sliced and have lengths. We call the element with length of 1 as atom element (cannot be sliced).

We use a Rle trait to express it. So Op, Change, elements inside RleTree all implement Rle. This gives us a compact way to represent the mergeable elements.

Container

Each op is associated with one container. Different CRDT algorithms use different types of containers. There are hierarchical relationship between containers, but they cannot affect each other

Convention

  • There are methods like id_last, id_end, lamport_last, lamport_end. last refers to the last one, but end refers to the exclusive end of a range. For example, OpSpan ranging from 0-0 till 0-8 has id_last of 0-8 and id_end of 0-9