Grove.Tree.LogMove (Grove v0.1.1)

View Source

Internal representation of a move operation in the operation log.

Tracks both old and new parents for efficient undo/redo. Operations are stored in the log even if invalid (for potential future validity).

This is part of Kleppmann's undo-do-redo algorithm for CRDT-safe tree moves.

Summary

Functions

Creates a LogMove from a Move operation and current tree state.

Types

t()

@type t() :: %Grove.Tree.LogMove{
  child_id: String.t(),
  metadata: map(),
  new_parent: String.t() | nil,
  old_parent: String.t() | nil,
  position: Grove.Node.position() | nil,
  timestamp: Grove.HybridLogicalClock.t(),
  valid?: boolean()
}

Functions

from_operation(tree, move)

Creates a LogMove from a Move operation and current tree state.

Captures old_parent from current node state for undo support.