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
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
apply_operation
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
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
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
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
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
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.
CRDTMessage—vuer.rtc.types.CRDTMessageOperation—vuer.rtc.types.OperationSceneGraph—vuer.rtc.types.SceneGraphSceneNode—vuer.rtc.types.SceneNodeOType—vuer.rtc.types.OTypemerge_clocks—vuer.rtc.types.merge_clocks