Skip to content

Package Structure

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 — depends on all of the below
lattice_coreReplicaId, VersionVector, DotContext — shared causal infrastructure
lattice_countersGCounter, PNCounter
lattice_registersLWWRegister, MVRegister
lattice_setsGSet, TwoPSet, ORSet
lattice_mapsLWWMap, ORMap, Crdt dispatch
graph BT
    core[lattice_core]
    counters[lattice_counters]
    registers[lattice_registers]
    sets[lattice_sets]
    maps[lattice_maps]
    crdt[lattice_crdt]

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

lattice_counters and lattice_sets 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

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

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

See Installation for full details.