k_bucket/
lib.rs

1#![cfg_attr(feature = "nightly", deny(missing_docs))]
2#![cfg_attr(feature = "nightly", feature(external_doc))]
3#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
4#![cfg_attr(test, deny(warnings))]
5#![cfg_attr(test, feature(plugin))]
6#![cfg_attr(test, plugin(clippy))]
7
8pub struct KBucket {}
9
10impl KBucket {
11  /// Create a new instance.
12  pub fn new() -> Self {
13    unimplemented!();
14  }
15
16  /// Default arbiter function for contacts with the same id. Uses
17  /// contact.vectorClock to select which contact to update the k-bucket with.
18  /// Contact with larger vectorClock field will be selected. If vectorClock is
19  /// the same, candidat will be selected.
20  pub fn arbiter(&self) {
21    unimplemented!();
22  }
23
24  /// Default distance function. Finds the XOR distance between firstId and
25  /// secondId.
26  pub fn distance(&self) {
27    unimplemented!();
28  }
29
30  /// Adds a contact to the k-bucket.
31  pub fn add(&self) {
32    unimplemented!();
33  }
34
35  /// Get the n closest contacts to the provided node id. "Closest" here means:
36  /// closest according to the XOR metric of the contact node id.
37  pub fn closest(&self) {
38    unimplemented!();
39  }
40
41  /// Counts the total number of contacts in the tree.
42  // Adapted from `.count()`.
43  pub fn len(&self) -> usize {
44    unimplemented!();
45  }
46
47  // Adapted from `.count()` - required by clippy.
48  pub fn is_empty(&self) -> bool {
49    self.len() == 0
50  }
51
52  /// Retrieves the contact.
53  pub fn get(&self) {
54    unimplemented!();
55  }
56
57  /// The metadata method serves as a container that can be used by
58  /// implementations using k-bucket. One example is storing a timestamp to
59  /// indicate the last time when a node in the bucket was responding to a
60  /// ping.
61  pub fn metadata(&self) {
62    unimplemented!();
63  }
64
65  /// Removes contact with the provided id.
66  pub fn remove(&self) {
67    unimplemented!();
68  }
69
70  /// Traverses the tree, putting all the contacts into one arraverses the tree,
71  /// putting all the contacts into one vector.
72  // Adapted from `.toArray()`.
73  pub fn to_vec(&self) {
74    unimplemented!();
75  }
76}