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
CRDTDocumenton disk as it changes. - CRDTDocumentStorage
- Everything one document has on disk: its changes and its snapshots.
- CRDTPeerIdStorage
-
The
PeerIdthis 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
Changeobjects in a SQLitesq.Database. - CRDTSqliteDocumentStorage
- The changes and snapshots of one document, in a SQLite database.
- CRDTSqlitePeerIdStorage
-
Stores the
PeerIdof one document in a SQLitesq.Database. - CRDTSqliteSnapshotStorage
-
Stores
Snapshotobjects in a SQLitesq.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
changesthat fall inside a version range. -
newestSnapshot(
Iterable< Snapshot> snapshots) → Snapshot? -
The newest of
snapshots, ornullwhen there is none.
Typedefs
- PersistentDocument = ({CRDTDocument document, CRDTDocumentPersistence persistence})
-
A
CRDTDocumentrestored from a backend, and the CRDTDocumentPersistence that keeps writing it.