Expand description
Implementation of SWIM protocol.
Please refer to SWIM paper for detailed description.
§Examples
use membership::{Node, ProtocolConfig};
use std::net::SocketAddr;
use failure::_core::str::FromStr;
use failure::_core::time::Duration;
let mut ms1 = Node::new(SocketAddr::from_str("127.0.0.1:2345").unwrap(), Default::default());
let mut ms2 = Node::new(SocketAddr::from_str("127.0.0.1:3456").unwrap(), Default::default());
ms1.start().unwrap();
ms2.join(SocketAddr::from_str("127.0.0.1:2345").unwrap()).unwrap();
std::thread::sleep(Duration::from_secs(ProtocolConfig::default().protocol_period * 2));
println!("{:?}", ms1.get_members().unwrap());
println!("{:?}", ms2.get_members().unwrap());
ms1.stop().unwrap();
ms2.stop().unwrap();
Structs§
- Runs the gossip protocol on an internal thread.
- Configuration for the membership protocol.
Type Aliases§
- Membership
Deprecated Alias for backward compatibility. Please use Node instead.