jellyflow_runtime/rules/delete/
mod.rs1mod builder;
2mod diagnostics;
3mod planner;
4mod selection;
5mod validation;
6
7use crate::io::NodeGraphInteractionState;
8use jellyflow_core::core::{EdgeId, Graph, NodeId};
9
10use super::DeletePlan;
11use planner::DeletePlanner;
12
13pub fn plan_delete_node(graph: &Graph, node: NodeId) -> DeletePlan {
15 plan_delete_node_with_policy(graph, node, &NodeGraphInteractionState::default())
16}
17
18pub fn plan_delete_node_with_policy(
20 graph: &Graph,
21 node: NodeId,
22 state: &NodeGraphInteractionState,
23) -> DeletePlan {
24 plan_delete_elements_with_policy(graph, [node], std::iter::empty::<EdgeId>(), state)
25}
26
27pub fn plan_delete_edge(graph: &Graph, edge: EdgeId) -> DeletePlan {
29 plan_delete_edge_with_policy(graph, edge, &NodeGraphInteractionState::default())
30}
31
32pub fn plan_delete_edge_with_policy(
34 graph: &Graph,
35 edge: EdgeId,
36 state: &NodeGraphInteractionState,
37) -> DeletePlan {
38 plan_delete_elements_with_policy(graph, std::iter::empty::<NodeId>(), [edge], state)
39}
40
41pub fn plan_delete_elements(
43 graph: &Graph,
44 nodes: impl IntoIterator<Item = NodeId>,
45 edges: impl IntoIterator<Item = EdgeId>,
46) -> DeletePlan {
47 plan_delete_elements_with_policy(graph, nodes, edges, &NodeGraphInteractionState::default())
48}
49
50pub fn plan_delete_elements_with_policy(
52 graph: &Graph,
53 nodes: impl IntoIterator<Item = NodeId>,
54 edges: impl IntoIterator<Item = EdgeId>,
55 state: &NodeGraphInteractionState,
56) -> DeletePlan {
57 DeletePlanner::new(graph, state).plan(nodes, edges)
58}