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
37
38
39
40
41
42
43
44
45
46
47
48
#![deny(missing_docs)]

//! Implementation of SWIM protocol.
//!
//! Please refer to [SWIM paper](https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf) 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();
//! ```

pub use crate::node::Node;
pub use crate::protocol_config::ProtocolConfig;

/// Alias for backward compatibility. Please use [Node](struct.Node.html) instead.
#[deprecated(since = "0.0.6", note = "Please use `Node` instead.")]
pub type Membership = Node;

mod disseminated;
mod incoming_message;
mod least_disseminated_members;
mod member;
mod message;
mod message_decoder;
mod message_encoder;
mod node;
mod notification;
mod protocol_config;
mod result;
mod suspicion;
mod sync_node;
mod unique_circular_buffer;

#[cfg(test)]
mod ututils;