crdt_lf_hive 0.5.2
crdt_lf_hive: ^0.5.2 copied to clipboard
Hive adapters for CRDT LF library objects, providing persistence for Change and Snapshot objects.
0.5.2 #
Date: 2026-10-04
Needs Dart 3.3 or later, like crdt_lf 5.1.0, and widens the crdt_lf_persistence constraint
to >=0.1.0 <0.3.0. No functional changes.
0.5.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.5.0 #
Date: 2026-09-07
Changed #
-
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. -
CRDTHive.open()gives aCRDTHiveBackend, theCRDTStorageBackendof this adapter. Hive cannot list its boxes, so the backend keeps a small registry box (documentsby default), written the first time a document is opened. A document stored before this registry existed is not on the list until it is opened once — its data is untouched either way. -
deleteDocumentDatais nowdeleteDocument, the name the contract uses. The static one leaves the registry alone;CRDTHiveBackend.deleteDocumentforgets the document as well, identity included. -
CRDTChangeStorageandCRDTSnapshotStorageare nowCRDTHiveChangeStorageandCRDTHiveSnapshotStorage, matching the other adapters. The old names belong to the contract they implement.CRDTDocumentStoragecomes fromcrdt_lf_persistenceand is re-exported, so the import path does not change. -
getChanges,getSnapshots,countandcontainsSnapshotstay synchronous — a Hive box keeps its entries in memory, and the return types say so.awaiton them is no longer valid, drop it. Writes go through the box journal and stay asynchronous. -
CRDTHivePeerIdStoragekeeps thePeerIda document writes under, so a restart no longer adds a peer to the version vector. Open it withCRDTHive.openPeerIdStorageForDocumentand read it before building the document; every document shares onepeer_idsbox, keyed by document id. -
getChangestakesnewerThanandupTo, bothVersionVectors: what a vector has not seen, what it has seen, or the range between them. -
isEmptyandisNotEmptyare gone from both storages. Usecount. -
openStorageForDocumentreturns aCRDTHiveDocumentStorage, whoseclose()closes that document's two boxes and nothing else. Hive has no transactions, sotransaction()keeps its default and just runs the body. -
Requires
crdt_lf: ^4.2.0.
Fixed #
-
Deleting an open document no longer hangs on the web. A box is an IndexedDB database, and the browser waits for every connection to close before it deletes one.
deleteDocumentnow closes the two boxes first.deleteBoxis unchanged — close the box yourself if you opened it. -
A document id no longer goes into a box name as it is. Hive lower-cases box names and refuses non-ASCII ones, so
Noteandnotemerged into one document and an accented id tripped an assert. Ids are now escaped: anything outsidea-z,0-9and-becomes~plus the hex of the byte, over UTF-8. A lower-case ASCII id keeps exactly the box name it had, so a 0.4.0 store reads back unchanged; only the ambiguous or broken ids move.documentBoxNameForis exported, for a migration written by hand.
0.4.0 #
Date: 2026-08-16
- Requires
crdt_lf: ^4.0.0instead of>=3.0.0 <5.0.0. - The Dart floor moves to
>=3.0.0, whichcrdt_lfnow needs.
0.3.1 #
Date: 2026-07-28
Widens the crdt_lf constraint to >=3.0.0 <5.0.0. No functional changes, and no migration of existing databases.
0.3.0+2 #
Date: 2026-07-19
- Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since
0.3.0.
0.3.0+1 #
Date: 2026-07-18
- Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since
0.3.0.
0.3.0 #
Date: 2026-06-11
Breaking changes
ChangeAdapterno longer accepts theuseDataAdapterparameter, which is removed. The adapter now always serializesChangeobjects viaChange.toBytes()/Change.fromBytes().SnapshotAdapteris now a thin wrapper aroundSnapshot.toBytes()/Snapshot.fromBytes(). TheuseDataAdapterconstructor parameter has been removed:Snapshot.datais always serialized viaJsonValueCodec(its values must be JSON-serializable).- Storage format changed: existing Hive boxes written with
0.xadapters are not readable by this version. A one-time migration (read with old adapter, write with new) is required before upgrading. - Removed adapters that are no longer part of the persistence pipeline (changes and snapshots are stored as opaque binary blobs):
PeerIdAdapter/kPeerIdAdapterHybridLogicalClockAdapter/kHybridLogicalClockAdapterOperationIdAdapter/kOperationIdAdapterVersionVectorAdapter/kVersionVectorAdapterFugueElementIDAdapter/kFugueElementIDAdapterFugueValueNodeAdapter/kFugueValueNodeAdapter
CRDTHive.initializesignature reduced to({int? changeTypeId, int? snapshotTypeId}). TheuseDataAdapter,peerIdTypeId,hybridLogicalClockTypeId,operationIdTypeId,versionVectorTypeId,fugueElementIdTypeId,fugueValueNodeTypeIdparameters have been removed.- Updated
crdt_lfdependency to^3.0.0.
Changed #
ChangeAdapterrewritten to use the compact binary format introduced bycrdt_lf3.0.0. Stores a raw byte list per change instead of JSON-encoded fields, reducing storage size and eliminating runtime JSON parsing.SnapshotAdapterrewritten as a single-byte-list wrapper aroundSnapshot.toBytes()/Snapshot.fromBytes(). No more recursiveBinaryWriter/BinaryReadercalls into nested types.
Removed #
OperationIdAdapter,PeerIdAdapter,HybridLogicalClockAdapter,VersionVectorAdapter,FugueElementIDAdapter,FugueValueNodeAdapterand theirk*Adaptertype-id constants. WithChangeandSnapshotserialized as binary blobs, no nested Hive adapters are involved in the pipeline.useDataAdapterflag fromSnapshotAdapterandCRDTHive.initialize. UseSnapshot.datawith JSON-serializable values instead.