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
|
use common::msg_id::MessageID;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
pub type BroadcastTarget = usize;
#[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(tag = "type")]
pub enum BroadcastBody {
#[serde(rename = "broadcast")]
Broadcast {
msg_id: Option<MessageID>,
message: BroadcastTarget,
},
#[serde(rename = "broadcast_ok")]
BroadcastOk { in_reply_to: MessageID },
#[serde(rename = "topology")]
Topology {
msg_id: Option<MessageID>,
topology: HashMap<String, HashSet<String>>,
},
#[serde(rename = "topology_ok")]
TopologyOk { in_reply_to: MessageID },
#[serde(rename = "read")]
Read { msg_id: MessageID },
#[serde(rename = "read_ok")]
ReadOk {
in_reply_to: MessageID,
messages: HashSet<BroadcastTarget>,
},
}
|