jellyflow_runtime/runtime/
commit.rs1use serde::{Deserialize, Serialize};
7
8use jellyflow_core::ops::{GraphOp, GraphTransaction};
9
10#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct NodeGraphPatch {
16 pub transaction: GraphTransaction,
18}
19
20impl NodeGraphPatch {
21 pub fn new(transaction: GraphTransaction) -> Self {
22 Self { transaction }
23 }
24
25 pub fn transaction(&self) -> &GraphTransaction {
26 &self.transaction
27 }
28
29 pub fn into_transaction(self) -> GraphTransaction {
30 self.transaction
31 }
32
33 pub fn ops(&self) -> &[GraphOp] {
34 self.transaction.ops()
35 }
36
37 pub fn is_empty(&self) -> bool {
38 self.transaction.is_empty()
39 }
40}
41
42impl From<GraphTransaction> for NodeGraphPatch {
43 fn from(transaction: GraphTransaction) -> Self {
44 Self::new(transaction)
45 }
46}