plistsync.core.crdt.graph

Graph topology: in-order tree with left/right children.

Overview

Classes

NodeID

Globally unique element ID, ordered lexicographically.

Side

Create a collection of name/value pairs.

Node

Structural node — topology only, no payload.

Graph

In-order tree with FugueMax sibling ordering.

Module Contents

class plistsync.core.crdt.graph.NodeID

Globally unique element ID, ordered lexicographically.

class plistsync.core.crdt.graph.Side(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

class plistsync.core.crdt.graph.Node

Structural node — topology only, no payload.

class plistsync.core.crdt.graph.Graph

In-order tree with FugueMax sibling ordering.

add(node: Node) None

Insert node at its declared parent/side (general path).

fast_append(node: Node) None

O(1) append — caller guarantees right child of last element, no siblings.

delete(node_id: NodeID) None

Mark node_id as deleted (tombstone).

right_origin(left_id: NodeID) NodeID | None

NodeID immediately after left_id in full traversal.

ancestor_closure(nid: NodeID) frozenset[NodeID]

Return nid and all its ancestors (transitive parent chain).

Traversal stops early if a parent is missing from the graph or a cycle is detected.