6 releases
0.0.6 | Feb 7, 2020 |
---|---|
0.0.5 | Sep 28, 2019 |
#18 in #swim
90KB
2.5K
SLoC
membership
Implementation of Scalable Weakly-consistent Infection-style Process Group Membership Protocol (SWIM) with extensions.
It's a pet project for learning Rust and is not to be used in production, at least for now.
lib.rs
:
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();
Dependencies
~7–16MB
~203K SLoC