1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::net::SocketAddr;
use crate::NodeState;
use crate::Pid;
/// Node registration information.
pub struct NodeRegistration {
/// The process responsible for this node.
pub supervisor: Option<Pid>,
/// The process responsible for sending outbound messages for this node.
pub sender: Option<Pid>,
/// The process responsible for receiving messages for this node.
pub receiver: Option<Pid>,
/// The state of this node.
pub state: NodeState,
/// The name of this node.
pub name: String,
/// The broadcast address of this node.
pub broadcast_address: SocketAddr,
}
impl NodeRegistration {
/// Constructs a new [NodeRegistration] from a given process, name, and broadcast address.
pub fn new(
supervisor: Option<Pid>,
state: NodeState,
name: String,
broadcast_address: SocketAddr,
) -> Self {
Self {
supervisor,
sender: None,
receiver: None,
state,
name,
broadcast_address,
}
}
}