accordsync_core 0.3.2 copy "accordsync_core: ^0.3.2" to clipboard
accordsync_core: ^0.3.2 copied to clipboard

Accord's pure merge core for Dart - hybrid logical clocks, operations and the lww, counter, set and conflict merge strategies.

accordsync_core #

Accord's merge core for Dart: hybrid logical clocks, operations and the four merge strategies.

Pure Dart, no I/O. Most apps use accordsync or accordsync_flutter, which re-export it.

Strategy Merges by
lww() Highest hybrid logical clock wins.
counter() Sum of every increment; none is ever lost.
set() Add-wins set: a remove only removes what its writer had seen.
conflict() Concurrent values are all kept and the field is flagged; a resolution supersedes exactly the values its writer saw.
import 'package:accordsync_core/accordsync_core.dart';

final schema = defineSchema({
  'dossier': {'visits': counter(), 'status': conflict()},
});
final a = LocalWriter(schema: schema, deviceId: 'a', now: () => DateTime.now().millisecondsSinceEpoch);
final b = LocalWriter(schema: schema, deviceId: 'b', now: () => DateTime.now().millisecondsSinceEpoch);

b.receive(a.inc('dossier:1', 'visits', 2));
a.receive(b.inc('dossier:1', 'visits', 3));
print(a.replica.read('dossier:1')); // {visits: 5}

It merges byte for byte like @accordsync/core: the test suite runs the shared golden vectors in every delivery order, and random scenarios generated by the TypeScript core must produce identical snapshots here.

Docs: accord.benhattab.pro/docs/schema · Source: crossben/accordsync-dart

0
likes
150
points
585
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Accord's pure merge core for Dart - hybrid logical clocks, operations and the lww, counter, set and conflict merge strategies.

Homepage
Repository (GitHub)
View/report issues

Topics

#offline-first #sync #crdt #local-first

License

Apache-2.0 (license)

More

Packages that depend on accordsync_core