plistsync.core.crdt.fugueΒΆ

Fugue β€” a list CRDT with interleaving of concurrent operations.

Inspired by The Art of the Fugue by Weidner & Kleppmann.

OverviewΒΆ

ClassesΒΆ

InsertPos

Positional info needed to reconstruct a Node on a remote replica.

InsertOp

Serialisable insert β€” structural pos + value.

DeleteOp

Serialisable delete.

Ops

Operation list with value lookup.

Fugue

Replicatable list with non-interleaving concurrent operations.

Module ContentsΒΆ

class plistsync.core.crdt.fugue.InsertPosΒΆ

Positional info needed to reconstruct a Node on a remote replica.

class plistsync.core.crdt.fugue.InsertOpΒΆ

Bases: Generic[T]

Serialisable insert β€” structural pos + value.

classmethod from_node(node: plistsync.core.crdt.graph.Node, value: T) InsertOp[T]ΒΆ

Construct an InsertOp from a Node and value.

class plistsync.core.crdt.fugue.DeleteOpΒΆ

Serialisable delete.

class plistsync.core.crdt.fugue.OpsΒΆ

Bases: Generic[T]

Operation list with value lookup.

get_value(node_id: plistsync.core.crdt.graph.NodeID) TΒΆ

Return the value for a given node_id.

class plistsync.core.crdt.fugue.Fugue(replica_id: int = 0, initial_counter: int = 0)ΒΆ

Bases: Generic[T]

Replicatable list with non-interleaving concurrent operations.

apply(op: InsertOp[T] | DeleteOp) NoneΒΆ

Apply a remote operation to this replica.

fork(replica_id: int) Fugue[T]ΒΆ

Return an independent copy with a new replica_id.

time_travel(version: plistsync.core.crdt.graph.NodeID) Fugue[T]ΒΆ

Return a new replica containing only operations causally before version.