Skip to content

Commit 140396c

Browse files
committed
Break off the sub-projects into separate repositories
1 parent 7db7a10 commit 140396c

35 files changed

+44
-730
lines changed

.github/workflows/quality_gate.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@ on: push
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
container:
11-
image: google/dart:latest
10+
image: google/dart:latest
1211

1312
steps:
1413
- uses: actions/checkout@v1
1514
- name: Verify code formatting
1615
run: dartfmt --dry-run --set-exit-if-changed .
1716
- name: Get dependencies
1817
run: pub get
19-
working-directory: crdt
2018
- name: Static code analysis
2119
run: dartanalyzer --fatal-infos --fatal-warnings .
22-
working-directory: crdt
2320
- name: Run tests
2421
run: pub run test
25-
working-directory: crdt
File renamed without changes.

.idea/libraries/Dart_Packages.xml

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

crdt/LICENSE renamed to LICENSE

File renamed without changes.

README.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
11
Dart implementation of Conflict-free Replicated Data Types (CRDTs).
22

3-
This is a multi project repository containing:
3+
This project is heavily influenced by James Long's talk [CRTDs for Mortals](https://www.dotconferences.com/2019/12/james-long-crdts-for-mortals) and includes a Dart-native implementation of Hybrid Local Clocks (HLC) based the paper [Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases](https://cse.buffalo.edu/tech-reports/2014-04.pdf).
44

5-
* [crdt](crdt): The CRDT package implementation.
6-
* [hive_crdt](hive_crdt): A CRDT implementation backed by a [Hive](https://pub.dev/packages/hive) store.
5+
It has [zero external dependencies](https://github.com/cachapa/crdt/blob/master/pubspec.yaml), so it should run everywhere where Dart runs.
6+
7+
## Usage
8+
9+
The `Crdt` class works as a layer on top of a map. The simplest way to experiment is to initialise it an empty map:
10+
11+
```dart
12+
import 'package:crdt/crdt.dart';
13+
14+
main() {
15+
// Insert a record
16+
crdt.put('a', 1);
17+
// Read the record
18+
print('Record: ${crdt.get('a')}');
19+
20+
// Export the CRDT as Json
21+
final json = crdt.toJson();
22+
// Send to remote node
23+
final remoteJson = sendToRemote(json);
24+
// Merge remote CRDT with local
25+
crdt.mergeJson(remoteJson);
26+
// Verify updated record
27+
print('Record after merging: ${crdt.get('a')}');
28+
}
29+
30+
// Mock sending the CRDT to a remote node and getting an updated one back
31+
String sendToRemote(String json) {
32+
final hlc = Hlc.now('another_nodeId');
33+
return '{"a":{"hlc":"$hlc","value":2}}';
34+
}
35+
```
36+
37+
You'll probably want to implement some sort of persistent storage by subclassing the `Crdt` class. An example using [Hive](https://pub.dev/packages/hive) is provided in the parent project.
38+
39+
## Example
40+
41+
An example of how it can be used in an application can be found at https://github.com/cachapa/crdt_server.
42+
43+
## Features and bugs
44+
45+
Please file feature requests and bugs at the [issue tracker](https://github.com/cachapa/crdt/issues).
File renamed without changes.

crdt/crdt.iml renamed to crdt.iml

File renamed without changes.

crdt/README.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)