MapCrdtBase class abstract

A CRDT backed by a simple in-memory hashmap. Useful for testing, or for applications which only require small, ephemeral datasets. It is incredibly inefficient.

Inheritance
Implementers

Constructors

MapCrdtBase(Iterable<String> tables)

Properties

canonicalTime Hlc
Represents the latest logical time seen in the stored data.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether this dataset is empty.
no setter
isNotEmpty bool
Whether this dataset has at least one record.
no setter
nodeId String
Get this CRDT's node id
no setterinherited
onTablesChanged Stream<({Hlc hlc, Iterable<String> tables})>
Emits a list of the tables affected by changes in the database and the timestamp at which they happened. Useful for guaranteeing atomic merges across multiple tables.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tables Set<String>
Names of all tables contained in this dataset.
final

Methods

get(String table, String key) → dynamic
Get a value from the local dataset.
getChangeset({Iterable<String>? onlyTables, String? onlyNodeId, String? exceptNodeId, Hlc? modifiedOn, Hlc? modifiedAfter}) CrdtChangeset
Get a Changeset using the provided changesetQueries.
override
getLastModified({String? onlyNodeId, String? exceptNodeId}) Hlc
Returns the last modified timestamp, optionally filtering for or against a specific node id. Useful to get "modified since" timestamps for synchronization. Returns Hlc.zero if no timestamp is found.
override
getMap(String table) Map<String, dynamic>
Get a table map from the local dataset.
getRecord(String table, String key) Record?
getRecords(String table) Map<String, Record>
merge(CrdtChangeset changeset) Future<void>
Merge changeset with the local dataset.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDatasetChanged(Iterable<String> affectedTables, Hlc hlc) → void
Notifies listeners and updates the canonical time.
inherited
put(String table, String key, dynamic value, [bool isDeleted = false]) Future<void>
Insert a single value into this dataset.
putAll(Map<String, Map<String, dynamic>> dataset, [bool isDeleted = false]) Future<void>
Insert multiple values into this dataset.
putRecords(Map<String, Map<String, Record>> dataset) FutureOr<void>
toString() String
A string representation of this object.
inherited
validateChangeset(CrdtChangeset changeset) Hlc
Checks if changeset is valid. This method is intended for implementations and shouldn't generally be called from outside.
inherited
watch(String table, {String? key}) Stream<WatchEvent>
Returns a stream of changes. Use the optional key parameter to filter events or leave it empty to get all changes.

Operators

operator ==(Object other) bool
The equality operator.
inherited