Skip to main content

Crate vectis_crdt

Crate vectis_crdt 

Source
Expand description

§vectis-crdt

CRDT engine for collaborative whiteboards.

vectis (lat.) = arrow, vector.

§Architecture

See [ARCHITECTURE.md] at the crate root for a comprehensive technical description of every design decision, algorithm, and trade-off.

§Quick overview

The whiteboard state is two independent CRDTs:

  • rga::RgaArray — YATA-style Replicated Growable Array for z-order. Each item is a stroke (not a point), so n is in the hundreds, not millions.
  • stroke::LwwRegister — Last-Write-Wins register per stroke property (color, width, opacity, transform). Independent registers enable granular concurrent merges without conflict.

The root entry point is document::Document. The Wasm-facing API lives in [wasm_bridge::WasmDocument] (feature wasm).

§Feature flags

FeatureDefaultDescription
wasmyesEnables wasm-bindgen and the JS API
compressnoEnables LZ4 compression for updates > 200 B

§Module map

ModuleRole
typesActorId, LamportTs, OpId, VectorClock
rgaYATA-style RGA, RgaArray, RgaItem, ItemState
strokeStrokePoint, StrokeData, Aabb, LwwRegister, StrokeProperties
documentDocument root, all CRDT operations, LwwMap
gcIncremental tombstone GC with MVV gating and origin re-parenting
encodingBinary wire format: LEB128 varints + LE floats
causal_bufferBuffers out-of-order remote ops until causally deliverable
awarenessEphemeral cursor positions (TTL-based, not CRDT)
compressionLZ4 feature-gated threshold compression
errorVectisError, VectisResult
[wasm_bridge]WasmDocument: zero-copy JS API (feature wasm)

Modules§

awareness
Ephemeral awareness state — cursor positions and actor presence.
causal_buffer
Causal ordering buffer.
compression
LZ4 compression layer for the wire format.
document
encoding
Binary encoding/decoding for operations and state.
error
gc
rga
stroke
types