Skip to main content

crdt_lf_drift 0.3.3 copy "crdt_lf_drift: ^0.3.3" to clipboard
crdt_lf_drift: ^0.3.3 copied to clipboard

drift storage adapter for CRDT LF library objects, providing persistence for Change and Snapshot objects.

CRDT LF Drift #

crdt_lf_drift_badge pub points pub likes codecov ci_badge License: MIT pub publisher

A Drift storage adapter for crdt_lf: it keeps your documents on the device, and reads them back on launch. Pick it when your app already uses Drift.

Read the full documentation

πŸ“– The full persistence guide β€” which adapter to pick, history, backups, compaction β€” is on mattiapispisa.it/crdt.

Features #

  • πŸ—„οΈ One database, many documents: three tables, with schema migrations
  • πŸ”’ Real transactions: a compaction lands all at once or not at all
  • ⏳ Asynchronous end to end, like the rest of Drift
  • πŸ”Œ Your executor: wrap a CRDTDriftDatabase on the QueryExecutor you choose
  • 🌐 Web: pass a Drift web database to CRDTDrift.fromDatabase
  • πŸͺͺ Peer identity: the device writes under the same author on every launch
  • 🧩 Same contract as the Hive and SQLite adapters: change backend with one line
  • βž• …and more: everything else is in the documentation

Quick start #

dart pub add crdt_lf crdt_lf_drift
import 'dart:io';

import 'package:crdt_lf/crdt_lf.dart';
import 'package:crdt_lf_drift/crdt_lf_drift.dart';

final backend = CRDTDrift.open(File('note.db'));

// Reads the stored note (or starts an empty one), then writes every edit.
final note = await backend.openDocument('note');
final text = CRDTFugueTextHandler(note.document, 'body');

text.insert(text.value.runes.length, 'Hello 🌍\n');

await note.persistence.dispose(); // writes what is still waiting
note.document.dispose();
await note.persistence.storage.close();
await backend.close();

Every change is written down from there on: the complete program, tested in CI, is the recipe. This package re-exports the whole crdt_lf_persistence API, so it is the only storage package your pubspec.yaml needs.

Documentation #

Roadmap #

Roadmap: done, in progress, to do

πŸ—ΊοΈ The project board shows what is done, what is in progress and what comes next, for this package and the rest of the workspace. Missing something? Open an issue: requests go on the board too.

Apps #

Packages #

Other bricks of the crdt "system" are:

0
likes
160
points
147
downloads

Documentation

API reference

Publisher

verified publishermattiapispisa.it

Weekly Downloads

drift storage adapter for CRDT LF library objects, providing persistence for Change and Snapshot objects.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#crdt #local-first #drift #persistence #dart

License

MIT (license)

Dependencies

crdt_lf, crdt_lf_persistence, drift, hlc_dart

More

Packages that depend on crdt_lf_drift