CausalGraph

stdx.crdt.causalGraph.CausalGraph
See theCausalGraph companion class
object CausalGraph

Attributes

Companion
class
Experimental
true
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class ClientEntry(seq: Number, var seqEnd: Number, version: LV)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def add(cg: CausalGraph, agent: String, _seqStart: Long, seqEnd: Long, _parents: IndexedSeq[LV]): CGEntry | Null
def addRaw(cg: CausalGraph, id: RawVersion, len: Long = ..., rawParents: Option[IndexedSeq[RawVersion]] = ...): CGEntry | Null
def advanceFrontier(frontier: IndexedSeq[LV], vLast: LV, parents: IndexedSeq[LV]): IndexedSeq[LV]
def advanceVersionFromSerialized(cg: CausalGraph, data: PartialSerializedCG, _version: IndexedSeq[LV]): IndexedSeq[LV]
def assignLocal(cg: CausalGraph, agentId: String, seq: Number)(parents: IndexedSeq[LV] = ..., num: Number = ...): LV
def checkCG(cg: CausalGraph): Unit
def clientEntriesForAgent(causalGraph: CausalGraph, agent: String): ArrayBuffer[ClientEntry]
def compareVersions(cg: CausalGraph, a: LV, b: LV): Number

Two versions have one of 4 different relationship configurations:

Two versions have one of 4 different relationship configurations:

  • They're equal (a == b)
  • They're concurrent (a || b)
  • Or one dominates the other (a < b or b > a)

This method depends on the caller to check if the passed versions are equal (a == b). Otherwise it returns 0 if the operations are concurrent, -1 if a < b or 1 if b > a

Attributes

def diff(cg: CausalGraph, a: IndexedSeq[LV], b: IndexedSeq[LV]): DiffResult

This method takes in two versions (expressed as frontiers) and returns the set of operations only appearing in the history of one version or the other.

This method takes in two versions (expressed as frontiers) and returns the set of operations only appearing in the history of one version or the other.

Attributes

def eachVersionBetween(cg: CausalGraph, vStart: LV, vEnd: LV, visit: (CGEntry, Number, Number) => Unit): Unit
def findClientEntry(cg: CausalGraph, agent: String, seq: Long): (ClientEntry, Long) | Null
def findClientEntryRaw(cg: CausalGraph, agent: String, seq: Long): ClientEntry | Null
def findClientEntryTrimmed(cg: CausalGraph, agent: String, seq: Long): ClientEntry | Null
def findConflicting(cg: CausalGraph, a: IndexedSeq[LV], b: IndexedSeq[LV], visit: (LVRange, DiffFlag) => Unit): IndexedSeq[LV]
def findDominators(cg: CausalGraph, versions: ArrayBuffer[LV]): ArrayBuffer[LV]
def findDominators2(cg: CausalGraph, versions: ArrayBuffer[LV], cb: (LV, Boolean) => Unit): Unit

Find the dominators amongst the input versions.

Find the dominators amongst the input versions.

Each item in the input will be output to the callback function exactly once.

If a version is repeated, it will only ever be counted as a dominator once.

The versions will be yielded from largest to smallest.

Attributes

def hasVersion(cg: CausalGraph, agent: String, seq: Long): Boolean
def insertRLEList[T](list: ArrayBuffer[T], newItem: T, getKey: T => Number, tryAppend: (T, T) => Boolean): Unit
def intersectWithSummary(cg: CausalGraph, summary: VersionSummary, versionsIn: ArrayBuffer[LV] = ...): (ArrayBuffer[LV], VersionSummary | Null)

Yields the intersection (most recent common version) and remainder (if any)

Yields the intersection (most recent common version) and remainder (if any)

Attributes

Scan the VersionSummary and report (via visitor function) which versions overlap.

Scan the VersionSummary and report (via visitor function) which versions overlap.

If you consider the venn diagram of versions, there are 3 categories:

  • a (only known locally)
  • a+b (common versions)
  • b (only known remotely)

Currently this method:

  • Ignores a only. Only a+b or b are yielded via the visitor
  • For a+b, we yield the local version
  • For b only, we yield a LV of -1.

Attributes

def iterVersionsBetween(cg: CausalGraph, vStart: LV, vEnd: LV): IterableOnce[CGEntry]
def lastOr[T, V](list: ArrayBuffer[T], f: T => V, `def`: V): V
def lvCmp(cg: CausalGraph, a: LV, b: LV): Int
def lvEq(a: IndexedSeq[LV], b: IndexedSeq[LV]): Boolean
def lvToRawList(cg: CausalGraph)(parents: IndexedSeq[LV] = ...): IndexedSeq[RawVersion]
def lvToRawWithParents(cg: CausalGraph, v: LV): (String, Number, IndexedSeq[LV])
def nextLV(cg: CausalGraph): LV
def nextSeqForAgent(cg: CausalGraph, agent: String): Long
def pushRLEList[T](list: ArrayBuffer[T], newItem: T, tryAppend: (T, T) => Boolean): Unit
def pushReversedRLE(list: ArrayBuffer[LVRange], start: LV, end: LV): Unit
def rawToLV(cg: CausalGraph, agent: String, seq: Number): LV
def rawToLVList(cg: CausalGraph, parents: IndexedSeq[RawVersion]): IndexedSeq[LV]
def rawToLVSpan(cg: CausalGraph, agent: String, seq: Number): (LV, LV)
def rawVersionCmp(r1: RawVersion, r2: RawVersion): Int
def serializeDiff(cg: CausalGraph, ranges: ArrayBuffer[LVRange]): PartialSerializedCG

The entries returned from this function are in the order of versions specified in ranges.

The entries returned from this function are in the order of versions specified in ranges.

Attributes

def sortVersions(v: ArrayBuffer[LV]): ArrayBuffer[LV]
def splitEntries(entries: ArrayBuffer[CGEntry]): ArrayBuffer[CGEntry]
def tryAppendEntries(a: CGEntry, b: CGEntry): Boolean
def tryRangeAppend(r1: LVRange, r2: LVRange): Boolean
def tryRawToLV(cg: CausalGraph, agent: String, seq: Number): LV | Null
def tryRevRangeAppend(r1: LVRange, r2: LVRange): Boolean
def versionContainsLV(cg: CausalGraph, frontier: ArrayBuffer[LV], target: LV): Boolean

Does frontier contain target?

Does frontier contain target?

Attributes