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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crate::log::Log;
use crate::nonce::Nonce;
use crate::request::Request;
use crate::viewstamp::{OpNumber, View};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Prepare<R, P> {
/// The current view of the replica.
pub view: View,
/// The op-number assigned to the request.
pub op_number: OpNumber,
/// The message received from the client along with a prediction for supporting non-deterministic behavior.
pub request: Request<R>,
/// The prediction of non-deterministic behavior performed at the primary.
pub prediction: P,
/// The op-number of the last committed log entry.
pub committed: OpNumber,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct PrepareOk {
/// The current view of the replica.
pub view: View,
/// The op-number assigned to the request.
pub op_number: OpNumber,
/// The index of the replica that prepared the operation.
pub index: usize,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Commit {
/// The current view of the replica.
pub view: View,
/// The op-number of the latest committed request known to the replica.
pub committed: OpNumber,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct GetState {
/// The current view of the replica.
pub view: View,
/// The latest op-number the replica is aware of.
pub op_number: OpNumber,
/// The index of the replica that needs to get the new state.
pub index: usize,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct NewState<R, P> {
/// The current view of the replica.
pub view: View,
/// An excerpt of the log based on the last known op number.
pub log: Log<R, P>,
/// The op-number of the latest committed request known to the replica.
pub committed: OpNumber,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct StartViewChange {
/// The current view of the replica.
pub view: View,
/// The index of the replica that needs to get the new state.
pub index: usize,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct DoViewChange<R, P> {
/// The current view of the replica.
pub view: View,
/// The log of the replica from its last normal view.
pub log: Log<R, P>,
/// The op-number of the latest committed request known to the replica.
pub committed: OpNumber,
/// The index of the replica that sent the message.
pub index: usize,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct StartView<R, P> {
/// The current view of the replica.
pub view: View,
/// The log to use in the new view.
pub log: Log<R, P>,
/// The op-number of the latest committed request known to the replica.
pub committed: OpNumber,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Recovery {
/// The index of the replica that needs to get the new state.
pub index: usize,
/// The last committed operation included in the checkpoint the replica used to recover.
pub committed: OpNumber,
/// A value coined for single use to detect replays of previous recovery requests.
pub nonce: Nonce,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct RecoveryResponse<R, P> {
/// The current view of the replica.
pub view: View,
/// A value coined for single use to detect replays of previous recovery requests.
pub nonce: Nonce,
/// The log to use in the new view.
pub log: Log<R, P>,
/// The op-number of the latest committed request known to the replica.
pub committed: OpNumber,
/// The index of the sender.
pub index: usize,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Checkpoint<C> {
/// The last committed operation reflected in the application state.
pub committed: OpNumber,
/// The application state when the checkpoint was taken.
pub state: C,
}