crdt
충돌 없는 복제 데이터 유형(CRDT)의 다트 구현.
충돌 없는 복제 데이터 유형(CRDT)의 다트 구현
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Dart implementation of Conflict-free Replicated Data Types (CRDTs).
This project is heavily influenced by James Long's talk CRTDs for Mortals and includes a Dart-native implementation of Hybrid Local Clocks (HLC) based on the paper Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases (pdf).
It has minimal external dependencies, so it should run anywhere where Dart runs, which is pretty much everywhere.
The Crdt class implements CRDT conflict resolution and serves as a storage-agnostic interface for specific implementations. Als included with this package is MapCrdt, an ephemeral implementation using Dart HashMaps.
Other implementations include (so far):
sql_crdt that benefits from PostgreSQL's performance and scalability intended for backend applications.See also crdt_sync, a turnkey approach for real-time network synchronization of Crdt nodes.
The simplest way to experiment with this package is to use the provided MapCrdt implementation:
import 'package:crdt/map_crdt.dart';
void main() {
var crdt1 = MapCrdt(['table']);
var crdt2 = MapCrdt(['table']);
print('Inserting 2 records in crdt1…');
crdt1.put('table', 'a', 1);
crdt1.put('table', 'b', 1);
print('crdt1: ${crdt1.getMap('table')}');
print('\nInserting a conflicting record in crdt2…');
crdt2.put('table', 'a', 2);
print('crdt2: ${crdt2.getMap('table')}');
print('\nMerging crdt2 into crdt1…');
crdt1.merge(crdt2.getChangeset());
print('crdt1: ${crdt1.getMap('table')}');
}
crdt is currently helping build local-first experiences for:
Are you using this package in your project? Let me know!
Please file feature requests and bugs at the issue tracker.