Skip to main content

rings_core/dht/
mod.rs

1#![warn(missing_docs)]
2//! Implementation of Ring's DHT
3//! which is based on CHORD, ref: <https://pdos.csail.mit.edu/papers/ton:chord/paper-ton.pdf>
4//! With high probability, the number of nodes that must be contacted to find a successor in an N-node network is O(log N).
5
6mod chord;
7pub mod did;
8/// Storage entry model used by Chord-backed DHT storage.
9pub mod entry;
10/// Finger table for Rings
11pub mod finger;
12mod stabilization;
13/// Subring model stored through DHT entries.
14pub mod subring;
15pub mod successor;
16/// Pure Chord topology transition model.
17pub mod topology;
18pub mod types;
19
20pub use chord::EntryStorage;
21pub use chord::PeerRing;
22pub use chord::PeerRingAction;
23pub use chord::RemoteAction as PeerRingRemoteAction;
24pub use chord::TopoInfo;
25pub use did::Did;
26pub use finger::FingerTable;
27pub use finger::DEFAULT_FINGER_TABLE_SIZE;
28pub use stabilization::Stabilizer;
29pub use successor::SuccessorReader;
30pub use successor::SuccessorWriter;
31pub use types::Chord;
32pub use types::ChordStorage;
33pub use types::ChordStorageCache;
34pub use types::ChordStorageRepair;
35pub use types::ChordStorageSync;
36pub use types::CorrectChord;
37pub use types::LiveDid;
38
39#[cfg(test)]
40pub mod tests {
41    //! test
42    use super::*;
43    use crate::ecc::tests::gen_ordered_keys;
44
45    /// Test get ordered did list
46    pub fn gen_ordered_dids(n: usize) -> Vec<Did> {
47        gen_ordered_keys(n)
48            .iter()
49            .map(|x| x.address().into())
50            .collect()
51    }
52}