refreshCanonicalTime method

void refreshCanonicalTime()

Iterates through the CRDT to find the highest HLC timestamp. Used to seed the Canonical Time. Should be overridden if the implementation can do it more efficiently.

Implementation

void refreshCanonicalTime() {
  final map = recordMap();
  _canonicalTime = Hlc.fromLogicalTime(
      map.isEmpty
          ? 0
          : map.values.map((record) => record.hlc.logicalTime).reduce(max),
      nodeId);
}