DAG class

DAG (Directed Acyclic Graph) implementation for CRDT

The DAG tracks the causal relationships between operations in the CRDT system. It is used to determine which operations are causally ready to be applied.

Constructors

DAG({required Map<OperationId, DAGNode> nodes, required Frontiers frontiers})
Creates a new DAG with the given nodes and frontiers
DAG.empty()
Creates a new empty DAG
factory

Properties

frontiers Set<OperationId>
Gets the current frontiers of the DAG
no setter
hashCode int
The hash code for this object.
no setterinherited
nodeCount int
Gets the number of nodes in the DAG
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
versionVector VersionVector
Returns the version vector of the DAG
no setter

Methods

addNode(OperationId id, Set<OperationId> deps) → void
Adds a new node to the DAG
clear() → void
Clears the DAG
containsNode(OperationId id) bool
Checks if the DAG contains a DAGNode with the given OperationId
getAncestors(OperationId id) Set<OperationId>
Gets all ancestors of a node
getAncestorsOfAll(Iterable<OperationId> ids) Set<OperationId>
Gets all ancestors of a set of nodes
getLCA(Set<OperationId> a, Set<OperationId> b) Set<OperationId>
Gets the lowest common ancestors (LCA) of two sets of nodes
getNode(OperationId id) DAGNode?
Gets a DAGNode by its OperationId
isReady(Set<OperationId> deps) bool
Checks if an operation with the given dependencies is causally ready
merge(DAG other) → void
Merges another DAG into this one
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prune(VersionVector version) int
Prunes the DAG history, keeping only nodes that happened after the given version.
toString() String
Returns a string representation of the DAG
override

Operators

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