hydro_lang/deploy/
in_memory_graph.rs
1use dfir_lang::graph::DfirGraph;
2
3use super::{LocalDeploy, Node, ProcessSpec};
4
5pub struct SingleProcessGraph {}
6
7impl LocalDeploy<'_> for SingleProcessGraph {
8 type Process = SingleNode;
9 type Cluster = SingleNode;
10 type ExternalProcess = SingleNode;
11 type Meta = ();
12 type GraphId = ();
13
14 fn has_trivial_node() -> bool {
15 true
16 }
17
18 fn trivial_process(_id: usize) -> Self::Process {
19 SingleNode {}
20 }
21
22 fn trivial_cluster(_id: usize) -> Self::Cluster {
23 SingleNode {}
24 }
25
26 fn trivial_external(_id: usize) -> Self::ExternalProcess {
27 SingleNode {}
28 }
29}
30
31impl ProcessSpec<'_, SingleProcessGraph> for () {
32 fn build(self, _id: usize, _name_hint: &str) -> SingleNode {
33 SingleNode {}
34 }
35}
36
37#[derive(Clone)]
38pub struct SingleNode {}
39
40impl Node for SingleNode {
41 type Port = ();
42 type Meta = ();
43 type InstantiateEnv = ();
44
45 fn next_port(&self) {
46 panic!();
47 }
48
49 fn update_meta(&mut self, _meta: &Self::Meta) {}
50
51 fn instantiate(
52 &self,
53 _env: &mut Self::InstantiateEnv,
54 _meta: &mut Self::Meta,
55 _graph: DfirGraph,
56 _extra_stmts: Vec<syn::Stmt>,
57 ) {
58 }
59}
60
61pub struct MultiGraph {}
62
63impl LocalDeploy<'_> for MultiGraph {
64 type Process = MultiNode;
65 type Cluster = MultiNode;
66 type ExternalProcess = MultiNode;
67 type Meta = ();
68 type GraphId = usize;
69
70 fn has_trivial_node() -> bool {
71 true
72 }
73
74 fn trivial_process(_id: usize) -> Self::Process {
75 MultiNode {}
76 }
77
78 fn trivial_cluster(_id: usize) -> Self::Cluster {
79 MultiNode {}
80 }
81
82 fn trivial_external(_id: usize) -> Self::ExternalProcess {
83 MultiNode {}
84 }
85}
86
87impl ProcessSpec<'_, MultiGraph> for () {
88 fn build(self, _id: usize, _name_hint: &str) -> MultiNode {
89 MultiNode {}
90 }
91}
92
93#[derive(Clone)]
94pub struct MultiNode {}
95
96impl Node for MultiNode {
97 type Port = ();
98 type Meta = ();
99 type InstantiateEnv = ();
100
101 fn next_port(&self) {
102 panic!();
103 }
104
105 fn update_meta(&mut self, _meta: &Self::Meta) {}
106
107 fn instantiate(
108 &self,
109 _env: &mut Self::InstantiateEnv,
110 _meta: &mut Self::Meta,
111 _graph: DfirGraph,
112 _extra_stmts: Vec<syn::Stmt>,
113 ) {
114 }
115}