crdt_lf_drift 0.3.1
crdt_lf_drift: ^0.3.1 copied to clipboard
drift storage adapter for CRDT LF library objects, providing persistence for Change and Snapshot objects.
0.3.1 #
Date: 2026-09-19
Widens the crdt_lf constraint to >=4.2.0 <6.0.0, so this package resolves against
crdt_lf 5.0.0 as well as 4.x. No functional changes.
0.3.0 #
Date: 2026-09-07
Changed #
-
A change is named by its author and its clock, not by a string:
changeshasauthor,hlcLandhlcCin place of the one text column. It is the same name written apart, so nothing is stored twice — and SQL can compare it, which is what a version vector asks. The clock takes two columns to stay inside the 53 bits JavaScript keeps exactly, since this adapter runs on the web. -
The schema is at version 2, and the package has a
MigrationStrategy. A database written by0.2.0gains thepeerstable, andchangesis rebuilt from its oldchange_idcolumn rather than from the stored bytes — so a change this build cannot decode still migrates. Snapshots stay as they are. -
The storages implement the shared contract from the new
crdt_lf_persistence, re-exported here so one import stays enough. Code written against a storage now runs on any adapter, andCRDTDocumentPersistencekeeps a whole document on disk for you — see that package's README. -
CRDTDriftis now aCRDTStorageBackend.documentIdsis aUNIONover the three tables, thepeersone included, so a document that was created and never written to is still listed.closeis now idempotent. -
deleteDocumentDatais nowdeleteDocument, the name the contract uses. Same behavior: the changes, the snapshots and the identity, in one transaction. -
CRDTDriftPeerIdStoragekeeps thePeerIda document writes under, in a newpeerstable, so a restart no longer adds a peer to the version vector. Read it before building the document, withdatabase.peerIdStorageForDocument(id).loadOrCreate(). -
getChangestakesnewerThanandupTo, bothVersionVectors. The database answers it: a change outside the range is never read and never decoded. -
Storage methods are declared
FutureOrby the contract. drift is asynchronous end to end, so every method here still returns aFutureand call sites do not change.transactionnow accepts aFutureOrbody. -
CRDTDocumentStoragecomes fromcrdt_lf_persistenceand is re-exported, so the import path does not change. -
isEmptyandisNotEmptyare gone from both storages. Usecount. -
storageForDocumentreturns aCRDTDriftDocumentStorage, whosetransaction()is a real drift transaction: a prune lands whole or not at all. Itsclose()does nothing — one file holds every document, so the connection staysCRDTDrift.close()'s to release. -
Requires
crdt_lf: ^4.2.0.
Fixed #
- A delete of very many changes no longer fails.
deleteChangesbuilt oneIN (?, ?, …)with a variable per id, and SQLite refuses more thanSQLITE_MAX_VARIABLE_NUMBERof them — which a long running document reached, since a prune hands over everything it removed at once. Deletes now go through a batch, one hit on the primary key each.deleteSnapshotscuts its ids into pieces instead, a snapshot id being an opaque string rather than a key the table is ordered by.
0.2.0 #
Date: 2026-08-16
- Requires
crdt_lf: ^4.0.0instead of>=3.0.0 <5.0.0.
0.1.1 #
Date: 2026-07-28
- Widens the
crdt_lfconstraint to>=3.0.0 <5.0.0. No functional changes, and no migration of existing databases.
0.1.0+2 #
Date: 2026-07-19
- Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since
0.1.0.
0.1.0+1 #
Date: 2026-07-18
- Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since
0.1.0.
0.1.0 #
Initial Release #
- Added
CRDTDriftutility class for opening a drift database (file or in-memory) - Added
CRDTDriftDatabasewithchangesandsnapshotstables - Added
CRDTDriftChangeStorageandCRDTDriftSnapshotStoragefor persistingChangeandSnapshotobjects as binary blobs, scoped per document via thedocument_idcolumn - Added
CRDTDocumentStoragecontainer bundling both storages for a document