DocumentCRDT class
Document CRDT state
Constructors
-
DocumentCRDT({required Map<
String, int> versionVector, required Uint8List content, required String contentHash, required int timestamp, required String contentType}) -
DocumentCRDT.fromDocument({required Map<
String, int> versionVector, required Uint8List content, required String contentHash, required int timestamp, required String contentType}) -
Create CRDT from existing document state
factory
- DocumentCRDT.initial({required String serverId, required Uint8List content, required String contentHash, required String contentType})
-
Create initial CRDT for a new document
factory
Properties
- content → Uint8List
-
Document content
final
- contentHash → String
-
Content hash (for verification)
final
- contentType → String
-
Content type
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp → int
-
Wall clock timestamp (for LWW tiebreaking)
final
-
versionVector
→ Map<
String, int> -
Version vector: serverId -> logical clock
final
Methods
-
copyWith(
{Map< String, int> ? versionVector, Uint8List? content, String? contentHash, int? timestamp, String? contentType}) → DocumentCRDT - Create a copy with updated fields
-
encodeVersionVector(
) → String - Encode version vector to JSON string for storage
-
happenedAfter(
DocumentCRDT other) → bool - Check if this version causally depends on (or is equal to) another
-
localUpdate(
{required String serverId, required Uint8List newContent, required String newContentHash, required String newContentType}) → DocumentCRDT - Increment version for a local update
-
merge(
DocumentCRDT other) → DocumentCRDT - Merge with another CRDT state
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decodeVersionVector(
String encoded) → Map< String, int> - Decode version vector from JSON string