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
//! Implementation of Ring's DHT
//!
//! which is based on CHORD, ref: <https://pdos.csail.mit.edu/papers/ton:chord/paper-ton.pdf>
//! With high probability, the number of nodes that must be contacted to find a successor in an N-node network is O(log N).
mod did;
pub use did::Did;
mod chord;
/// Finger table for Rings
pub mod finger;
mod successor;
mod types;
pub use chord::PeerRing;
pub use chord::PeerRingAction;
pub use chord::RemoteAction as PeerRingRemoteAction;
pub use finger::FingerTable;
pub use types::Chord;
pub use types::ChordStorage;
mod stabilization;
pub use stabilization::Stabilization;
pub use stabilization::TStabilize;
/// Implement Subring with VNode
pub mod subring;
/// VNode is a special node that only has virtual address
pub mod vnode;

#[cfg(test)]
pub mod tests {
    use super::*;
    use crate::ecc::tests::gen_ordered_keys;

    pub fn gen_ordered_dids(n: usize) -> Vec<Did> {
        gen_ordered_keys(n)
            .iter()
            .map(|x| x.address().into())
            .collect()
    }
}