jellyflow_runtime/runtime/lookups/apply/
mod.rs1mod edges;
2mod groups;
3mod nodes;
4mod ports;
5
6use super::NodeGraphLookups;
7use jellyflow_core::core::Graph;
8use jellyflow_core::ops::{GraphOp, GraphTransaction};
9
10impl NodeGraphLookups {
11 pub fn apply_transaction(&mut self, graph: &Graph, tx: &GraphTransaction) {
12 for op in tx.ops() {
13 if !self.apply_op(graph, op) {
14 self.rebuild_from(graph);
15 return;
16 }
17 }
18 }
19
20 fn apply_op(&mut self, graph: &Graph, op: &GraphOp) -> bool {
21 match op {
22 GraphOp::AddNode { id, node } => self.apply_add_node(*id, node),
23 GraphOp::RemoveNode { id, edges, .. } => self.apply_remove_node(*id, edges),
24 GraphOp::SetNodePos { id, to, .. } => self.apply_set_node_pos(graph, *id, *to),
25 GraphOp::SetNodeOrigin { id, to, .. } => self.apply_set_node_origin(*id, *to),
26 GraphOp::SetNodeKind { id, to, .. } => self.apply_set_node_kind(graph, *id, to),
27 GraphOp::SetNodeKindVersion { id, to, .. } => {
28 self.apply_set_node_kind_version(graph, *id, *to)
29 }
30 GraphOp::SetNodeParent { id, to, .. } => self.apply_set_node_parent(*id, *to),
31 GraphOp::SetNodeSize { id, to, .. } => self.apply_set_node_size(*id, *to),
32 GraphOp::SetNodeHidden { id, to, .. } => self.apply_set_node_hidden(*id, *to),
33 GraphOp::SetNodeCollapsed { id, to, .. } => self.apply_set_node_collapsed(*id, *to),
34 GraphOp::SetNodePorts { id, to, .. } => self.apply_set_node_ports(*id, to),
35 GraphOp::RemovePort {
36 id, port, edges, ..
37 } => self.apply_remove_port(*id, port, edges),
38 GraphOp::AddEdge { id, .. } => self.apply_add_edge(graph, *id),
39 GraphOp::RemoveEdge { id, .. } => self.apply_remove_edge(*id),
40 GraphOp::SetEdgeKind { id, to, .. } => self.apply_set_edge_kind(graph, *id, *to),
41 GraphOp::SetEdgeReconnectable { id, to, .. } => {
42 self.apply_set_edge_reconnectable(graph, *id, *to)
43 }
44 GraphOp::SetEdgeEndpoints { id, from, to } => {
45 self.apply_set_edge_endpoints(graph, *id, *from, *to)
46 }
47 GraphOp::RemoveGroup { detached, .. } => self.apply_remove_group(detached),
48
49 GraphOp::SetNodeSelectable { .. }
50 | GraphOp::SetNodeFocusable { .. }
51 | GraphOp::SetNodeDraggable { .. }
52 | GraphOp::SetNodeConnectable { .. }
53 | GraphOp::SetNodeDeletable { .. }
54 | GraphOp::SetNodeExtent { .. }
55 | GraphOp::SetNodeExpandParent { .. }
56 | GraphOp::SetNodeData { .. }
57 | GraphOp::AddPort { .. }
58 | GraphOp::SetPortConnectable { .. }
59 | GraphOp::SetPortConnectableStart { .. }
60 | GraphOp::SetPortConnectableEnd { .. }
61 | GraphOp::SetPortType { .. }
62 | GraphOp::SetPortData { .. }
63 | GraphOp::SetEdgeSelectable { .. }
64 | GraphOp::SetEdgeFocusable { .. }
65 | GraphOp::SetEdgeHidden { .. }
66 | GraphOp::SetEdgeInteractionWidth { .. }
67 | GraphOp::SetEdgeDeletable { .. }
68 | GraphOp::AddImport { .. }
69 | GraphOp::RemoveImport { .. }
70 | GraphOp::SetImportAlias { .. }
71 | GraphOp::AddSymbol { .. }
72 | GraphOp::RemoveSymbol { .. }
73 | GraphOp::SetSymbolName { .. }
74 | GraphOp::SetSymbolType { .. }
75 | GraphOp::SetSymbolDefaultValue { .. }
76 | GraphOp::SetSymbolMeta { .. }
77 | GraphOp::AddGroup { .. }
78 | GraphOp::SetGroupRect { .. }
79 | GraphOp::SetGroupTitle { .. }
80 | GraphOp::SetGroupColor { .. }
81 | GraphOp::AddStickyNote { .. }
82 | GraphOp::RemoveStickyNote { .. }
83 | GraphOp::SetStickyNoteText { .. }
84 | GraphOp::SetStickyNoteRect { .. }
85 | GraphOp::SetStickyNoteColor { .. }
86 | GraphOp::AddBinding { .. }
87 | GraphOp::RemoveBinding { .. }
88 | GraphOp::SetBindingSubject { .. }
89 | GraphOp::SetBindingTarget { .. }
90 | GraphOp::SetBindingKind { .. }
91 | GraphOp::SetBindingMeta { .. } => true,
92 }
93 }
94}