Rename `AllExcept` parameter from `known` to `exclude`.

This commit is contained in:
pawanjay176 2019-05-17 00:23:47 +05:30
parent 7f46250057
commit 85e8e97b0a
5 changed files with 11 additions and 11 deletions

View File

@ -121,12 +121,12 @@ impl<M: Send> Messaging<M> {
}
}).map_err(Error::from);
},
Target::AllExcept(known) => {
// Send the message to all remote nodes not in `known`, stopping at the first
Target::AllExcept(exclude) => {
// Send the message to all remote nodes not in `exclude`, stopping at the first
// error.
let filtered_txs: Vec<_> = (0..txs_to_comms.len())
.collect::<BTreeSet<_>>()
.difference(known)
.difference(exclude)
.cloned()
.collect();
result = filtered_txs.iter()

View File

@ -281,8 +281,8 @@ where
}
}
}
Target::AllExcept(known) => {
for node in self.nodes.values_mut().filter(|n| !known.contains(&n.id)) {
Target::AllExcept(exclude) => {
for node in self.nodes.values_mut().filter(|n| !exclude.contains(&n.id)) {
if node.id != ts_msg.sender_id {
node.add_message(ts_msg.clone())
}

View File

@ -264,10 +264,10 @@ where
));
}
}
hbbft::Target::AllExcept(known) => {
hbbft::Target::AllExcept(exclude) => {
for to in nodes
.keys()
.filter(|&to| to != &stepped_id && !known.contains(to))
.filter(|&to| to != &stepped_id && !exclude.contains(to))
{
if !faulty {
message_count = message_count.saturating_add(1);

View File

@ -168,8 +168,8 @@
//! on_step(*id, step, &mut messages, &mut finished_nodes);
//! }
//! }
//! Target::AllExcept(known) => {
//! for (id, node) in nodes.iter_mut().filter(|&(id, _)| !known.contains(id)) {
//! Target::AllExcept(exclude) => {
//! for (id, node) in nodes.iter_mut().filter(|&(id, _)| !exclude.contains(id)) {
//! let step = node.handle_message(&source, message.clone())?;
//! on_step(*id, step, &mut messages, &mut finished_nodes);
//! }

View File

@ -283,13 +283,13 @@ where
}
}
}
Target::AllExcept(known) => {
Target::AllExcept(exclude) => {
let is_accepted = |&them| msg.message.is_accepted(them, max_future_epochs);
let is_premature = |&them| msg.message.is_premature(them, max_future_epochs);
let is_obsolete = |&them| msg.message.is_obsolete(them);
let filtered_nodes: BTreeMap<_, _> = peer_epochs
.iter()
.filter(|(id, _)| !known.contains(id))
.filter(|(id, _)| !exclude.contains(id))
.map(|(k, v)| (k.clone(), *v))
.collect();
if filtered_nodes.values().all(is_accepted) {