Vuer

vuer.rtc.operations.dispatcher

Dispatcher for applying CRDT messages and operations to scene graphs.

This module provides functions that match the TypeScript API:

  • applyMessage(graph, msg) -> new_graph (immutable)
  • applyMessages(graph, messages) -> new_graph (immutable)
  • applyOperation(graph, op, meta) -> None (mutable)
  • applyMessageMut(graph, msg) -> None (mutable)
  • applyMessagesMut(graph, messages) -> None (mutable)

OperationMeta

python
class OperationMeta

Source

Metadata passed to apply functions.

Attributes: lamport_time: Lamport timestamp for LWW operations session_id: Session that created the operation timestamp: Wall-clock timestamp

OperationMeta.init

python
def __init__(self, lamport_time: int, session_id: str='', timestamp: Optional[float]=None)

Source

apply_operation

python
def apply_operation(graph: SceneGraph, op: Operation, meta: OperationMeta) -> None

Source

Apply a single operation to the graph (mutable, modifies in place).

Args: graph: The scene graph to modify op: The operation to apply meta: Operation metadata (lamport time, session ID, etc.)

Raises: ValueError: If the operation type is not supported or node not found

apply_message_mut

python
def apply_message_mut(graph: SceneGraph, msg: CRDTMessage) -> None

Source

Apply a CRDT message to the graph (mutable, modifies in place).

Args: graph: The scene graph to modify msg: The message containing operations to apply

apply_messages_mut

python
def apply_messages_mut(graph: SceneGraph, messages: List[CRDTMessage]) -> None

Source

Apply multiple CRDT messages to the graph (mutable, modifies in place).

Messages are applied in order. For correct behavior, ensure messages are sorted by lamport time.

Args: graph: The scene graph to modify messages: List of messages to apply

apply_message

python
def apply_message(graph: SceneGraph, msg: CRDTMessage) -> SceneGraph

Source

Apply a CRDT message to the graph (immutable, returns new graph).

Args: graph: The source scene graph (not modified) msg: The message containing operations to apply

Returns: A new SceneGraph with the operations applied

apply_messages

python
def apply_messages(graph: SceneGraph, messages: List[CRDTMessage]) -> SceneGraph

Source

Apply multiple CRDT messages to the graph (immutable, returns new graph).

Messages are applied in order. For correct behavior, ensure messages are sorted by lamport time.

Args: graph: The source scene graph (not modified) messages: List of messages to apply

Returns: A new SceneGraph with all operations applied

rebuild_graph

python
def rebuild_graph(snapshot_graph: SceneGraph, journal_entries: List['JournalEntry'], pending_ops: Optional[List[Operation]]=None, lamport_time: int=0, session_id: str='') -> SceneGraph

Source

Rebuild the graph from a snapshot and journal entries.

This is used after undo/redo or when restoring from a checkpoint.

Args: snapshot_graph: The starting graph state journal_entries: Journal entries to replay (filtered for non-deleted) pending_ops: Optional uncommitted operations to apply lamport_time: Current lamport time for pending ops session_id: Session ID for pending ops

Returns: Rebuilt scene graph

Public imports

These symbols are available from this module. Their definitions are documented in the linked modules.