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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use crate::{
ConnectionId, DialerId, DocumentActorId, ListenerId,
actors::{
hub::{Command, CommandId},
messages::DocToHubMsgPayload,
},
network::{DialerConfig, ListenerConfig},
};
#[derive(Debug, Clone)]
pub(crate) enum HubInput {
Command {
command_id: CommandId,
command: Box<Command>,
},
Tick,
/// Message received from a document actor
ActorMessage {
actor_id: DocumentActorId,
message: DocToHubMsgPayload,
},
/// Notification that a network connection has been lost externally
ConnectionLost {
connection_id: ConnectionId,
},
/// Register a new dialer
AddDialer {
command_id: CommandId,
config: DialerConfig,
},
/// Register a new listener
AddListener {
command_id: CommandId,
config: ListenerConfig,
},
/// Create a connection for a dialer (IO layer successfully established transport)
CreateDialerConnection {
command_id: CommandId,
dialer_id: DialerId,
},
/// Create a connection for a listener (IO layer accepted an inbound transport)
CreateListenerConnection {
command_id: CommandId,
listener_id: ListenerId,
},
/// The IO layer failed to establish a transport for a dialer
DialFailed {
dialer_id: DialerId,
error: String,
},
/// Remove a dialer and close its connection
RemoveDialer {
dialer_id: DialerId,
},
/// Remove a listener and close all its connections
RemoveListener {
listener_id: ListenerId,
},
Stop,
}