crdt_lf_hive library

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

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

Classes

ChangeAdapter
Hive adapter for Change objects.
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.
CRDTHive
Main utility class for initializing Hive with CRDT adapters.
CRDTHiveBackend
The CRDTStorageBackend of the Hive adapter.
CRDTHiveChangeStorage
Stores Change objects in a Hive box.
CRDTHiveDocumentStorage
The changes and snapshots of one document, in two Hive boxes.
CRDTHivePeerIdStorage
Stores the PeerId of one document in a Hive box.
CRDTHiveSnapshotStorage
Stores Snapshot objects in a Hive box.
CRDTPeerIdStorage
The PeerId this device writes under, for one document.
CRDTSnapshotStorage
The Snapshots of one document, as a backend keeps them.
CRDTStorageBackend
Everything one backend holds: the documents, and what each of them is made of.
SnapshotAdapter
Hive adapter for Snapshot objects.

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

documentBoxNameFor(String prefix, String documentId) → String
The box name of documentId under prefix.
escapeForBoxName(String documentId) → String
The escaped form of documentId. See documentBoxNameFor.
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.