MapCrdtTable class

In-memory CrdtTable backed by the crdt package's MapCrdt.

Keeps the whole dataset in RAM and is not persisted. It is meant for tests and small, ephemeral collections. Select it explicitly with Passnote.builder(...).engine(MapCrdtTable.new); the default engine is disk-backed (SqliteCrdtTable).

Implemented types

Constructors

MapCrdtTable(String table)
Creates an empty in-memory table named table.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isPersistent → bool
Whether this table owns its own durability.
no setteroverride
nodeId → String
The identifier of this replica, as stamped into the node component of the HLCs this table generates.
no setteroverride
recoveries → Stream<CrdtRecovery>
Emits once if init found the local store unreadable and rebuilt it (from an on-disk snapshot, or empty).
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

changeset(String table, {String? sinceHlc, String? untilHlc}) → Future<CrdtChangeset>
Returns records in table in CrdtChangeset format.
override
close() → Future<void>
Releases resources (a disk-backed engine closes its file). The default is a no-op. Called by Collection.dispose.
override
compact(String table, {required Duration horizon}) → Future<int>
Permanently removes tombstoned records whose wall-clock time is older than horizon and returns the number of reclaimed records.
override
docFields(String table, Iterable<String> docIds) → Future<Map<String, Map<String, Object?>>>
One scan of the table, grouping only the requested documents.
override
ensureQueryIndex(String table, String fieldPath) → Future<void>
A no-op: this engine has no indexes and answers queries by scanning.
override
init() → Future<void>
Initializes the table from storage (called by Collection during startup when isPersistent is true).
override
liveFields(String table, String prefix) → Future<Map<String, Object?>>
Returns all live (non-tombstoned) records in table whose key starts with prefix, as a flat map of key → value.
override
liveKeys(String table, String prefix) → Set<String>
All live (non-tombstoned) keys in table whose key starts with prefix.
override
maxHlc(String table) → String
The highest HLC seen in table as a string, or the empty string when the table is empty.
override
merge(CrdtChangeset changeset) → Future<void>
Merges a CrdtChangeset received from a peer or loaded from storage.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String table, String key, Object? value, {bool isDeleted = false, CrdtType crdtType = const LwwRegister()}) → Future<void>
crdtType is ignored: the crdt package's MapCrdt record shape has no slot for it. Typed values are self-describing (they carry their own type tag), so the TypedCrdtTable layer above still merges them correctly; a persistent engine records the type as well.
override
queryDocIds(String table, QuerySpec spec) → Future<List<QueryRow>>
Answers by a full scan: this engine has no indexes. The scan mirrors the SQLite engine's comparison semantics, so pages line up across engines.
override
rangeDigest(String table, {String? fromHlc, String? toHlc}) → Future<RangeDigest>
One pass over the full changeset — this engine is in-memory anyway.
override
recordHlc(String table, String key) → Future<String?>
The stored HLC string of the record at table/key — tombstoned or live — or null when no record exists.
override
rekey(List<int> newKey) → Future<void>
Re-encrypts the store at rest under newKey, keeping all data.
override
toString() → String
A string representation of this object.
inherited
value(String table, String key) → Future<Object?>
Returns the live value for key in table, or null if absent or tombstoned.
override
watch(String table) → Stream<void>
A broadcast stream that emits whenever any record in table changes.
override

Operators

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