1pub use self::operate::Operate;
4pub use self::subgraph::{Subgraph, SubgraphBuilder};
5pub use self::timestamp::{Timestamp, PathSummary};
6pub use self::change_batch::ChangeBatch;
7pub use self::frontier::Antichain;
8
9pub mod change_batch;
10pub mod frontier;
11pub mod timestamp;
12pub mod operate;
13pub mod broadcast;
14pub mod reachability;
15pub mod subgraph;
16
17#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Abomonation, Serialize, Deserialize)]
19pub struct Location {
20 pub node: usize,
22 pub port: Port,
24}
25
26impl Location {
27 pub fn new_target(node: usize, port: usize) -> Location {
29 Location { node, port: Port::Target(port) }
30 }
31 pub fn new_source(node: usize, port: usize) -> Location {
33 Location { node, port: Port::Source(port) }
34 }
35 pub fn is_target(&self) -> bool { matches!(self.port, Port::Target(_)) }
37 pub fn is_source(&self) -> bool { matches!(self.port, Port::Source(_)) }
39}
40
41impl From<Target> for Location {
42 fn from(target: Target) -> Self {
43 Location {
44 node: target.node,
45 port: Port::Target(target.port),
46 }
47 }
48}
49
50impl From<Source> for Location {
51 fn from(source: Source) -> Self {
52 Location {
53 node: source.node,
54 port: Port::Source(source.port),
55 }
56 }
57}
58
59#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Abomonation, Serialize, Deserialize)]
61pub enum Port {
62 Target(usize),
64 Source(usize),
66}
67
68#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
73pub struct Source {
74 pub node: usize,
76 pub port: usize,
78}
79
80impl Source {
81 pub fn new(node: usize, port: usize) -> Self {
83 Self { node, port }
84 }
85}
86
87#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
92pub struct Target {
93 pub node: usize,
95 pub port: usize,
97}
98
99impl Target {
100 pub fn new(node: usize, port: usize) -> Self {
102 Self { node, port }
103 }
104}