Skip to main content

jellyflow_runtime/runtime/events/
snapshot.rs

1use crate::io::{
2    NodeGraphEditorConfig, NodeGraphInteractionConfig, NodeGraphRuntimeTuning, NodeGraphViewState,
3};
4use jellyflow_core::core::Graph;
5use jellyflow_core::ops::GraphHistory;
6
7/// Immutable snapshot of store state for selector subscriptions.
8#[derive(Debug, Clone, Copy)]
9pub struct NodeGraphStoreSnapshot<'a> {
10    pub graph: &'a Graph,
11    pub graph_revision: u64,
12    pub layout_facts_revision: u64,
13    pub view_state: &'a NodeGraphViewState,
14    pub interaction: &'a NodeGraphInteractionConfig,
15    pub runtime_tuning: &'a NodeGraphRuntimeTuning,
16    pub history: &'a GraphHistory,
17}
18
19impl<'a> NodeGraphStoreSnapshot<'a> {
20    pub(crate) fn new(
21        graph: &'a Graph,
22        graph_revision: u64,
23        layout_facts_revision: u64,
24        view_state: &'a NodeGraphViewState,
25        interaction: &'a NodeGraphInteractionConfig,
26        runtime_tuning: &'a NodeGraphRuntimeTuning,
27        history: &'a GraphHistory,
28    ) -> Self {
29        Self {
30            graph,
31            graph_revision,
32            layout_facts_revision,
33            view_state,
34            interaction,
35            runtime_tuning,
36            history,
37        }
38    }
39}
40
41/// Atomic document replacement snapshot.
42#[derive(Debug, Clone, Copy)]
43pub struct NodeGraphDocumentSnapshot<'a> {
44    pub graph: &'a Graph,
45    pub graph_revision: u64,
46    pub view_state: &'a NodeGraphViewState,
47    pub editor_config: &'a NodeGraphEditorConfig,
48}