viewstamped_replication/
mail.rs

1use crate::protocol::{
2    Commit, DoViewChange, GetState, NewState, Prepare, PrepareOk, Recovery, RecoveryResponse,
3    StartView, StartViewChange,
4};
5use crate::request::{ClientIdentifier, Reply};
6use crate::service::Protocol;
7
8pub trait Outbox<P>
9where
10    P: Protocol,
11{
12    fn prepare(&mut self, message: Prepare<P::Request, P::Prediction>);
13
14    fn prepare_ok(&mut self, index: usize, message: PrepareOk);
15
16    fn commit(&mut self, message: Commit);
17
18    fn get_state(&mut self, index: usize, message: GetState);
19
20    fn new_state(&mut self, index: usize, message: NewState<P::Request, P::Prediction>);
21
22    fn start_view_change(&mut self, message: StartViewChange);
23
24    fn do_view_change(&mut self, index: usize, message: DoViewChange<P::Request, P::Prediction>);
25
26    fn start_view(&mut self, message: StartView<P::Request, P::Prediction>);
27
28    fn recovery(&mut self, message: Recovery);
29
30    fn recovery_response(
31        &mut self,
32        index: usize,
33        message: RecoveryResponse<P::Request, P::Prediction>,
34    );
35
36    fn reply(&mut self, client: ClientIdentifier, reply: &Reply<P::Reply>);
37}
38
39pub trait Inbox<P>
40where
41    P: Protocol,
42{
43    fn push_prepare(&mut self, message: Prepare<P::Request, P::Prediction>);
44
45    fn push_prepare_ok(&mut self, message: PrepareOk);
46
47    fn push_commit(&mut self, message: Commit);
48
49    fn push_get_state(&mut self, message: GetState);
50
51    fn push_new_state(&mut self, message: NewState<P::Request, P::Prediction>);
52
53    fn push_start_view_change(&mut self, message: StartViewChange);
54
55    fn push_do_view_change(&mut self, message: DoViewChange<P::Request, P::Prediction>);
56
57    fn push_start_view(&mut self, message: StartView<P::Request, P::Prediction>);
58
59    fn push_recovery(&mut self, message: Recovery);
60
61    fn push_recovery_response(&mut self, message: RecoveryResponse<P::Request, P::Prediction>);
62}
63
64pub trait Mailbox<P>: Inbox<P> + Outbox<P>
65where
66    P: Protocol,
67{
68}