crdt_lf_sqlite library

A sqlite3 storage implementation for CRDT (Conflict-free Replicated Data Type) objects.

This library provides storage utilities for persisting CRDT Changes and Snapshots in a single SQLite database, organized by document. It also stores the PeerId each document writes under, so a reopened document is the same author it was before.

Classes

CRDTChangeStorage
The Changes of one document, as a backend keeps them.
CRDTDocumentPersistence
Keeps a CRDTDocument on disk as it changes.
CRDTDocumentStorage
Everything one document has on disk: its changes and its snapshots.
CRDTPeerIdStorage
The PeerId this device writes under, for one document.
CRDTSnapshotStorage
The Snapshots of one document, as a backend keeps them.
CRDTSqlite
Main utility class for persisting CRDT objects in a SQLite database.
CRDTSqliteChangeStorage
Stores Change objects in a SQLite sq.Database.
CRDTSqliteDocumentStorage
The changes and snapshots of one document, in a SQLite database.
CRDTSqlitePeerIdStorage
Stores the PeerId of one document in a SQLite sq.Database.
CRDTSqliteSnapshotStorage
Stores Snapshot objects in a SQLite sq.Database.
CRDTStorageBackend
Everything one backend holds: the documents, and what each of them is made of.

Extensions

CRDTDocumentStorageReading on CRDTDocumentStorage
Reading a CRDTDocumentStorage without following it, and copying one.
CRDTFutureOr on FutureOr<T>
Chaining for a value that may or may not be a Future.
CRDTPeerIdStorageLoad on CRDTPeerIdStorage
The read-or-mint step every caller of a CRDTPeerIdStorage takes.
CRDTSnapshotStorageLatest on CRDTSnapshotStorage
The read-then-pick step a caller of a CRDTSnapshotStorage takes to restore.
CRDTStorageBackendDocuments on CRDTStorageBackend
Opening, reading and copying the documents of a CRDTStorageBackend.

Functions

filterByVersion(List<Change> changes, {VersionVector? newerThan, VersionVector? upTo}) → List<Change>
Keeps the changes that fall inside a version range.
newestSnapshot(Iterable<Snapshot> snapshots) → Snapshot?
The newest of snapshots, or null when there is none.

Typedefs

PersistentDocument = ({CRDTDocument document, CRDTDocumentPersistence persistence})
A CRDTDocument restored from a backend, and the CRDTDocumentPersistence that keeps writing it.