Skip to content

Commit ef304ab

Browse files
committed
Update example
1 parent ede4962 commit ef304ab

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
## 5.1.0
2+
3+
- Fix `Hlc` in Dart web
4+
- Breaking: replaced `millis` time representation with `DateTime` object
5+
- Breaking: removed `logicalTime` operators from `Hlc` since they failed silently in 32-bit environments
6+
- Add `watch` method to `MapCrdtBase`
7+
18
## 5.0.2
9+
210
- Add convenience function to parse over-the-wire changesets
311

412
## 5.0.1
13+
514
- Fix dependency compatibility with the Flutter SDK
615

716
## 5.0.0
17+
818
This version introduces a major refactor which results in multiple breaking changes. This was done with the intention to make this package the basis for a family of CRDT libraries.
919

1020
Another motivation was to make this package compatible with [crdt_sync](https://github.com/cachapa/crdt_sync), thereby abstracting the communication protocol and network management for real-time remote synchronization.
@@ -16,18 +26,23 @@ Changes:
1626
- Reimplemented CrdtMap as a zero-dependency implementation
1727

1828
## 4.0.3
29+
1930
- Update to Dart 3
2031

2132
## 4.0.2
33+
2234
- Add purge() method to reset the data store
2335

2436
## 4.0.1
37+
2538
- Fix edge case when merging remote records
2639

2740
## 4.0.0
41+
2842
- Migrate to Dart null safety
2943

3044
## 3.0.0
45+
3146
- Use milliseconds instead of microseconds for HLCs
3247
- Allow using non-string node ids
3348
- Allow watching for changes
@@ -37,19 +52,24 @@ Changes:
3752
- Move HiveCrdt project to its own repo: https://github.com/cachapa/hive_crdt
3853

3954
## 2.2.2
55+
4056
- Hlc: Add convenience `fromDate` constructor
4157
- HiveCrdt: Fix NPE when getting a non-existing record
4258

4359
## 2.2.1
60+
4461
- Crdt: Fix encoder return type
4562

4663
## 2.2.0
64+
4765
- Crdt: Pass keys to map encoder and decoder, useful to disambiguate when parsing
4866

4967
## 2.1.1
68+
5069
- Crdt: Fix HLC timestamp generation for dart-web
5170

5271
## 2.1.0
72+
5373
- Hlc: Add `const` keywords to constructors wherever possible
5474
- Crdt: Expose canonical time
5575
- Crdt: Add convenience methods (isEmpty. length, etc.)
@@ -64,35 +84,42 @@ Changes:
6484
- HiveCrdt: Fix DateTime key serialization
6585

6686
## 2.0.0
87+
6788
- Remove CrdtStore.
6889
- Make Crdt abstract.
6990
- Remove watches (they can be added in subclasses - see HiveCrdt).
7091
- Add MapCrdt, a CRDT backed by a standard Map useful for testing or for volatile datasets.
7192
- Add HiveCrdt as a submodule, A CRDT backed by a [Hive](https://pub.dev/packages/hive) store.
7293

7394
## 1.2.2
95+
7496
- Fix incrementing the HLC when merging newer records.
7597
- Fix counter not being able to reach maximum (0xFFFF)
7698

7799
## 1.2.1
100+
78101
- Remove unnecessary Future in `Crdt.values` getter.
79102

80103
## 1.2.0
104+
81105
- Breaking: `Crdt.get()` now returns the value (or `null`) rather than the record. Use `Crdt.getRecord()` for the previous behaviour.
82106
- API Change: Getter methods on both `Crdt` and `Store` are now synchronous.
83107
- API Change: `Crdt.Clear()` now accepts `purgeRecords` to determine if records should be purged or marked as deleted.
84108
- Add `Crdt.watch()` and `Store.watch()` to monitor the CRDT for changes.
85109
- Add `Crdt.isDeleted()` to check if a record has been deleted.
86110

87111
## 1.1.1
112+
88113
- Add values getter which retrieves all values as list, excluding deleted records
89114

90115
## 1.1.0
116+
91117
- HLCs implement Comparable
92118
- Support typed key and values
93119
- Refactor CRDT and Store to replace index operators with getters and setters
94120
- Add clear() method
95121
- Add JSON de/serialisation helper methods
96122

97123
## 1.0.0
124+
98125
- Initial version

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ void main() {
2929
crdt1.put('table', 'a', 1);
3030
crdt1.put('table', 'b', 1);
3131
32-
print('crdt1: ${crdt1.get('table')}');
32+
print('crdt1: ${crdt1.getMap('table')}');
3333
3434
print('\nInserting a conflicting record in crdt2…');
3535
crdt2.put('table', 'a', 2);
3636
37-
print('crdt2: ${crdt2.get('table')}');
37+
print('crdt2: ${crdt2.getMap('table')}');
3838
3939
print('\nMerging crdt2 into crdt1…');
4040
crdt1.merge(crdt2.getChangeset());
4141
42-
print('crdt1: ${crdt1.get('table')}');
42+
print('crdt1: ${crdt1.getMap('table')}');
4343
}
4444
```
4545

example/crdt_example.dart example/example.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:crdt/src/map_crdt/map_crdt.dart';
1+
import 'package:crdt/map_crdt.dart';
22

33
void main() {
44
var crdt1 = MapCrdt(['table']);

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: crdt
22
description: Dart implementation of Conflict-free Replicated Data Types (CRDTs).
3-
version: 5.0.2
3+
version: 5.1.0
44
homepage: https://github.com/cachapa/crdt
55
repository: https://github.com/cachapa/crdt
66
issue_tracker: https://github.com/cachapa/crdt/issues

0 commit comments

Comments
 (0)