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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use std::sync::Arc;
use crate::communicator::{CoordNumOf, RoundNumOf};
use crate::node::{NodeStatus, Shutdown, Snapshot};
use crate::state::{EventOf, LogEntryOf, State};
use crate::{CoordNum, RoundNum};
pub type ShutdownEventFor<S> = ShutdownEvent<
<S as Shutdown>::State,
RoundNumOf<<S as Shutdown>::Communicator>,
CoordNumOf<<S as Shutdown>::Communicator>,
>;
#[non_exhaustive]
#[derive(Debug)]
pub enum Event<S: State, R: RoundNum> {
Init {
status: NodeStatus,
state: Option<Arc<S>>,
},
StatusChange {
old_status: NodeStatus,
new_status: NodeStatus,
},
Install { round: R, state: Arc<S> },
Commit {
round: R,
log_entry: Arc<LogEntryOf<S>>,
},
Apply {
round: R,
log_entry: Arc<LogEntryOf<S>>,
result: EventOf<S>,
},
Gaps(Vec<Gap<R>>),
}
#[derive(Clone, Debug)]
pub struct Gap<R: RoundNum> {
pub since: std::time::Instant,
pub rounds: std::ops::Range<R>,
}
#[derive(Debug)]
pub enum ShutdownEvent<S: State, R: RoundNum, C: CoordNum> {
Regular(Event<S, R>),
#[non_exhaustive]
Last {
snapshot: Option<Snapshot<S, R, C>>,
},
}