InMemoryCRDTServerRegistry class

In-memory implementation of CRDTServerRegistry.

This implementation stores all documents in memory using a Map. Documents are lost when the server restarts.

Implemented types
Mixed-in types

Constructors

InMemoryCRDTServerRegistry({Map<String, CRDTDocument>? documents, Map<String, Snapshot>? snapshots})
In-memory implementation of CRDTServerRegistry.

Properties

documentCount Future<int>
Get the number of documents registered
no setteroverride
documentIds Future<Set<String>>
Get all document IDs
no setteroverride
documents Map<String, CRDTDocument>
Get a copy of all documents (for debugging/testing purposes)
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snapshotsByDocument Map<String, Snapshot>
Get a copy of all snapshots (for debugging/testing purposes)
no setter

Methods

addDocument(String documentId, {PeerId? author}) Future<void>
Register a document
override
afterSnapshot(String documentId, Snapshot snapshot) Future<void>
Keeps the snapshot createSnapshot just took, so getLatestSnapshot can hand it back. There is nowhere else for it to go.
override
applyChange(String documentId, Change change) Future<bool>
Applies change to documentId and returns whether it was new.
inherited
clear() Future<void>
Clear all documents and snapshots
close() Future<void>
Disposes every document and forgets it.
override
createSnapshot(String documentId) Future<Snapshot>
Snapshots documentId and hands the snapshot to afterSnapshot.
inherited
getDocument(String documentId) Future<CRDTDocument?>
Get a store for an existing document
override
getLatestSnapshot(String documentId) Future<Snapshot?>
Get the latest snapshot of a document
override
hasDocument(String documentId) Future<bool>
Check if a document exists
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeDocument(String documentId) Future<void>
Remove a document
override
requireDocument(String documentId) Future<CRDTDocument>
The document documentId holds, or throws ArgumentError when this registry does not serve it.
inherited
toString() String
A string representation of this object.
inherited

Operators

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