Skip to content

lattice / orientation

Package Structure

How lattice is organized into focused packages.

lattice is organized as a family of focused packages. Each package covers one category of CRDTs. You can depend on the umbrella lattice_crdt for everything, or pick individual packages for minimal dependencies.

PackageVersionDocsWhat it provides
lattice_crdtUmbrella for the core CRDT packages
lattice_coreReplicaId, VersionVector, DotContext — shared causal infrastructure
lattice_countersGCounter, PNCounter
lattice_registersLWWRegister, MVRegister
lattice_setsGSet, TwoPSet, ORSet
lattice_mapsLWWMap, ORMap, Crdt dispatch
lattice_sequenceGeneric ordered-list CRDT with move support
lattice_textPlain-text CRDT backed by lattice_sequence
lattice_presenceDistributed presence CRDT with topic/key/pid/meta tracking
graph BT
    core[lattice_core]
    counters[lattice_counters]
    registers[lattice_registers]
    sets[lattice_sets]
    maps[lattice_maps]
    sequence[lattice_sequence]
    text[lattice_text]
    presence[lattice_presence]
    crdt[lattice_crdt]

    registers --> core
    maps --> core
    maps --> counters
    maps --> registers
    maps --> sets
    text --> sequence
    crdt --> core
    crdt --> counters
    crdt --> registers
    crdt --> sets
    crdt --> maps
    crdt --> sequence
    crdt --> text

lattice_counters, lattice_sets, and lattice_presence have no lattice dependencies beyond gleam_stdlib and gleam_json, making them the lightest packages to depend on.

In Gleam, imports come from the package name. Even when you install the umbrella lattice_crdt, you import from the sub-package names:

import lattice_core/replica_id
import lattice_counters/g_counter
import lattice_sets/or_set
import lattice_maps/or_map
import lattice_sequence/sequence
import lattice_text/text
import lattice_presence/presence_state

Start with lattice_crdt if you are getting started, prototyping, or using CRDTs from multiple categories. One dependency gives you the core CRDTs.

Pick individual packages when binary size or dependency count matters, or when you only need one category of CRDT. For example, if you only need counters:

Terminal window
gleam add lattice_counters

Add lattice_presence separately when you need distributed presence tracking; it is intentionally independent of the lattice_crdt umbrella package.

See Installation for full details.