DottedLattice

kofre.dotted.DottedLattice
See theDottedLattice companion object
trait DottedLattice[A] extends Lattice[Dotted[A]]

The delta CRDT paper introduces a lot of individual abstractions that all do a lot of cool stuff, but often not separated into their pieces. This is one of those pieces systematically handling removals based on metadata.

The context encodes dots that have been seen. The store of type A is assumed to be something that stores individual information per dot. We represent removals as context that contains a dot, but a store that no longer contains the dot. Thus, when merging the abstract logic is somewhat along the lines of: Both contain the (dot, value) pair? => merge value recursively. Only one contains the dot in the context? => keep that value. Both contain the dot, but at least one has no matching value? => remove all values for that dot.

Separating into a mergePartial allows extracting the context into the outermost layer reducing metadata overhead.

Attributes

Companion:
object
Graph
Supertypes
trait Lattice[Dotted[A]]
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Value members

Abstract methods

def mergePartial(left: Dotted[A], right: Dotted[A]): A

Partial merging combines the stored values, but ignores the context. Thus enabling nested merging of values, without merging context multiple times.

Partial merging combines the stored values, but ignores the context. Thus enabling nested merging of values, without merging context multiple times.

Attributes

Concrete methods

def contextbimap[B](to: Dotted[A] => Dotted[B], from: Dotted[B] => Dotted[A]): DottedLattice[B]
override def lteq(left: Dotted[A], right: Dotted[A]): Boolean

Lattice order is derived from merge, but should be overridden for efficiency

Lattice order is derived from merge, but should be overridden for efficiency

Attributes

Definition Classes
def merge(left: Dotted[A], right: Dotted[A]): Dotted[A]

By assumption: associative, commutative, idempotent.

By assumption: associative, commutative, idempotent.

For use with Delta CRDTs, this function should be optimized for the case that left >> right, i.e., that left is the current state and right the delta

Attributes

Inherited methods

def decompose(a: Dotted[A]): Iterable[A]

Decompose a state into potentially smaller parts. The only requirement is that merging the decomposed results produces the original state. Requires a bottom to enable automatic decomposition of Product types Note that the goal here is small individual storage size at reasonable computational cost. Minimalism of returned results is not guaranteed. It is also not guaranteed that the result does not overlap.

Decompose a state into potentially smaller parts. The only requirement is that merging the decomposed results produces the original state. Requires a bottom to enable automatic decomposition of Product types Note that the goal here is small individual storage size at reasonable computational cost. Minimalism of returned results is not guaranteed. It is also not guaranteed that the result does not overlap.

Attributes

Inherited from:
Lattice
def diff(state: Dotted[A], delta: Dotted[A]): Option[A]

computes delta without state

computes delta without state

Attributes

Inherited from:
Lattice

Extensions

Extensions

extension (left: Dotted[A])
def mergePartial(right: Dotted[A]): A

Inherited extensions

extension (left: A)
def <=(right: A): Boolean

Lattice order is derived from merge, but should be overridden for efficiency.

Lattice order is derived from merge, but should be overridden for efficiency.

Attributes

Inherited from:
Lattice
def decomposed: Iterable[A]

Attributes

Inherited from:
Lattice
def merge(right: A): A

Attributes

Inherited from:
Lattice