@libp2p/kad-dht 12.0.15 → 12.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/index.min.js +4 -4
  2. package/dist/src/constants.d.ts.map +1 -1
  3. package/dist/src/constants.js +1 -1
  4. package/dist/src/constants.js.map +1 -1
  5. package/dist/src/content-routing/index.d.ts.map +1 -1
  6. package/dist/src/content-routing/index.js +3 -2
  7. package/dist/src/content-routing/index.js.map +1 -1
  8. package/dist/src/index.d.ts +34 -1
  9. package/dist/src/index.d.ts.map +1 -1
  10. package/dist/src/index.js.map +1 -1
  11. package/dist/src/network.d.ts +3 -0
  12. package/dist/src/network.d.ts.map +1 -1
  13. package/dist/src/network.js +33 -8
  14. package/dist/src/network.js.map +1 -1
  15. package/dist/src/peer-list/peer-distance-list.d.ts +13 -4
  16. package/dist/src/peer-list/peer-distance-list.d.ts.map +1 -1
  17. package/dist/src/peer-list/peer-distance-list.js +29 -21
  18. package/dist/src/peer-list/peer-distance-list.js.map +1 -1
  19. package/dist/src/peer-routing/index.d.ts +5 -5
  20. package/dist/src/peer-routing/index.d.ts.map +1 -1
  21. package/dist/src/peer-routing/index.js +15 -24
  22. package/dist/src/peer-routing/index.js.map +1 -1
  23. package/dist/src/query/manager.d.ts +3 -0
  24. package/dist/src/query/manager.d.ts.map +1 -1
  25. package/dist/src/query/manager.js +14 -5
  26. package/dist/src/query/manager.js.map +1 -1
  27. package/dist/src/query/query-path.d.ts +6 -6
  28. package/dist/src/query/query-path.d.ts.map +1 -1
  29. package/dist/src/query/query-path.js +32 -20
  30. package/dist/src/query/query-path.js.map +1 -1
  31. package/dist/src/routing-table/index.d.ts +11 -5
  32. package/dist/src/routing-table/index.d.ts.map +1 -1
  33. package/dist/src/routing-table/index.js +84 -42
  34. package/dist/src/routing-table/index.js.map +1 -1
  35. package/dist/src/routing-table/k-bucket.d.ts +80 -115
  36. package/dist/src/routing-table/k-bucket.d.ts.map +1 -1
  37. package/dist/src/routing-table/k-bucket.js +165 -311
  38. package/dist/src/routing-table/k-bucket.js.map +1 -1
  39. package/dist/src/routing-table/refresh.d.ts.map +1 -1
  40. package/dist/src/routing-table/refresh.js +9 -4
  41. package/dist/src/routing-table/refresh.js.map +1 -1
  42. package/package.json +8 -10
  43. package/src/constants.ts +1 -1
  44. package/src/content-routing/index.ts +3 -2
  45. package/src/index.ts +37 -1
  46. package/src/network.ts +38 -9
  47. package/src/peer-list/peer-distance-list.ts +36 -25
  48. package/src/peer-routing/index.ts +19 -28
  49. package/src/query/manager.ts +18 -5
  50. package/src/query/query-path.ts +46 -30
  51. package/src/routing-table/index.ts +100 -46
  52. package/src/routing-table/k-bucket.ts +214 -359
  53. package/src/routing-table/refresh.ts +10 -4
  54. package/dist/src/query/utils.d.ts +0 -6
  55. package/dist/src/query/utils.d.ts.map +0 -1
  56. package/dist/src/query/utils.js +0 -53
  57. package/dist/src/query/utils.js.map +0 -1
  58. package/src/query/utils.ts +0 -64
@@ -4,10 +4,11 @@ import { PeerQueue } from '@libp2p/utils/peer-queue';
4
4
  import { pbStream } from 'it-protobuf-stream';
5
5
  import { Message, MessageType } from '../message/dht.js';
6
6
  import * as utils from '../utils.js';
7
- import { KBucket } from './k-bucket.js';
7
+ import { KBucket, isLeafBucket } from './k-bucket.js';
8
8
  export const KAD_CLOSE_TAG_NAME = 'kad-close';
9
9
  export const KAD_CLOSE_TAG_VALUE = 50;
10
10
  export const KBUCKET_SIZE = 20;
11
+ export const PREFIX_LENGTH = 32;
11
12
  export const PING_TIMEOUT = 10000;
12
13
  export const PING_CONCURRENCY = 10;
13
14
  /**
@@ -20,6 +21,8 @@ export class RoutingTable extends TypedEventEmitter {
20
21
  pingQueue;
21
22
  log;
22
23
  components;
24
+ prefixLength;
25
+ splitThreshold;
23
26
  pingTimeout;
24
27
  pingConcurrency;
25
28
  running;
@@ -29,19 +32,20 @@ export class RoutingTable extends TypedEventEmitter {
29
32
  metrics;
30
33
  constructor(components, init) {
31
34
  super();
32
- const { kBucketSize, pingTimeout, logPrefix, pingConcurrency, protocol, tagName, tagValue } = init;
33
35
  this.components = components;
34
- this.log = components.logger.forComponent(`${logPrefix}:routing-table`);
35
- this.kBucketSize = kBucketSize ?? KBUCKET_SIZE;
36
- this.pingTimeout = pingTimeout ?? PING_TIMEOUT;
37
- this.pingConcurrency = pingConcurrency ?? PING_CONCURRENCY;
36
+ this.log = components.logger.forComponent(`${init.logPrefix}:routing-table`);
37
+ this.kBucketSize = init.kBucketSize ?? KBUCKET_SIZE;
38
+ this.pingTimeout = init.pingTimeout ?? PING_TIMEOUT;
39
+ this.pingConcurrency = init.pingConcurrency ?? PING_CONCURRENCY;
38
40
  this.running = false;
39
- this.protocol = protocol;
40
- this.tagName = tagName ?? KAD_CLOSE_TAG_NAME;
41
- this.tagValue = tagValue ?? KAD_CLOSE_TAG_VALUE;
41
+ this.protocol = init.protocol;
42
+ this.tagName = init.tagName ?? KAD_CLOSE_TAG_NAME;
43
+ this.tagValue = init.tagValue ?? KAD_CLOSE_TAG_VALUE;
44
+ this.prefixLength = init.prefixLength ?? PREFIX_LENGTH;
45
+ this.splitThreshold = init.splitThreshold ?? KBUCKET_SIZE;
42
46
  this.pingQueue = new PeerQueue({
43
47
  concurrency: this.pingConcurrency,
44
- metricName: `${logPrefix.replaceAll(':', '_')}_ping_queue`,
48
+ metricName: `${init.logPrefix.replaceAll(':', '_')}_ping_queue`,
45
49
  metrics: this.components.metrics
46
50
  });
47
51
  this.pingQueue.addEventListener('error', evt => {
@@ -49,7 +53,10 @@ export class RoutingTable extends TypedEventEmitter {
49
53
  });
50
54
  if (this.components.metrics != null) {
51
55
  this.metrics = {
52
- routingTableSize: this.components.metrics.registerMetric(`${logPrefix.replaceAll(':', '_')}_routing_table_size`)
56
+ routingTableSize: this.components.metrics.registerMetric(`${init.logPrefix.replaceAll(':', '_')}_routing_table_size`),
57
+ routingTableKadBucketTotal: this.components.metrics.registerMetric(`${init.logPrefix.replaceAll(':', '_')}_routing_table_kad_bucket_total`),
58
+ routingTableKadBucketAverageOccupancy: this.components.metrics.registerMetric(`${init.logPrefix.replaceAll(':', '_')}_routing_table_kad_bucket_average_occupancy`),
59
+ routingTableKadBucketMaxDepth: this.components.metrics.registerMetric(`${init.logPrefix.replaceAll(':', '_')}_routing_table_kad_bucket_max_depth`)
53
60
  };
54
61
  }
55
62
  }
@@ -59,8 +66,13 @@ export class RoutingTable extends TypedEventEmitter {
59
66
  async start() {
60
67
  this.running = true;
61
68
  const kBuck = new KBucket({
62
- localNodeId: await utils.convertPeerId(this.components.peerId),
63
- numberOfNodesPerKBucket: this.kBucketSize,
69
+ localPeer: {
70
+ kadId: await utils.convertPeerId(this.components.peerId),
71
+ peerId: this.components.peerId
72
+ },
73
+ kBucketSize: this.kBucketSize,
74
+ prefixLength: this.prefixLength,
75
+ splitThreshold: this.splitThreshold,
64
76
  numberOfNodesToPing: 1
65
77
  });
66
78
  this.kb = kBuck;
@@ -70,6 +82,16 @@ export class RoutingTable extends TypedEventEmitter {
70
82
  this.log.error('could not process k-bucket ping event', err);
71
83
  });
72
84
  });
85
+ let peerStorePeers = 0;
86
+ // add existing peers from the peer store to routing table
87
+ for (const peer of await this.components.peerStore.all()) {
88
+ if (peer.protocols.includes(this.protocol)) {
89
+ const id = await utils.convertPeerId(peer.id);
90
+ this.kb.add({ kadId: id, peerId: peer.id });
91
+ peerStorePeers++;
92
+ }
93
+ }
94
+ this.log('added %d peer store peers to the routing table', peerStorePeers);
73
95
  // tag kad-close peers
74
96
  this._tagPeers(kBuck);
75
97
  }
@@ -86,7 +108,7 @@ export class RoutingTable extends TypedEventEmitter {
86
108
  _tagPeers(kBuck) {
87
109
  let kClosest = new PeerSet();
88
110
  const updatePeerTags = utils.debounce(() => {
89
- const newClosest = new PeerSet(kBuck.closest(kBuck.localNodeId, KBUCKET_SIZE).map(contact => contact.peer));
111
+ const newClosest = new PeerSet(kBuck.closest(kBuck.localPeer.kadId, KBUCKET_SIZE));
90
112
  const addedPeers = newClosest.difference(kClosest);
91
113
  const removedPeers = kClosest.difference(newClosest);
92
114
  Promise.resolve()
@@ -115,11 +137,11 @@ export class RoutingTable extends TypedEventEmitter {
115
137
  });
116
138
  kBuck.addEventListener('added', (evt) => {
117
139
  updatePeerTags();
118
- this.safeDispatchEvent('peer:add', { detail: evt.detail.peer });
140
+ this.safeDispatchEvent('peer:add', { detail: evt.detail.peerId });
119
141
  });
120
142
  kBuck.addEventListener('removed', (evt) => {
121
143
  updatePeerTags();
122
- this.safeDispatchEvent('peer:remove', { detail: evt.detail.peer });
144
+ this.safeDispatchEvent('peer:remove', { detail: evt.detail.peerId });
123
145
  });
124
146
  }
125
147
  /**
@@ -139,7 +161,7 @@ export class RoutingTable extends TypedEventEmitter {
139
161
  const { oldContacts, newContact } = evt.detail;
140
162
  const results = await Promise.all(oldContacts.map(async (oldContact) => {
141
163
  // if a previous ping wants us to ping this contact, re-use the result
142
- const pingJob = this.pingQueue.find(oldContact.peer);
164
+ const pingJob = this.pingQueue.find(oldContact.peerId);
143
165
  if (pingJob != null) {
144
166
  return pingJob.join();
145
167
  }
@@ -149,8 +171,8 @@ export class RoutingTable extends TypedEventEmitter {
149
171
  const options = {
150
172
  signal: AbortSignal.timeout(this.pingTimeout)
151
173
  };
152
- this.log('pinging old contact %p', oldContact.peer);
153
- const connection = await this.components.connectionManager.openConnection(oldContact.peer, options);
174
+ this.log('pinging old contact %p', oldContact.peerId);
175
+ const connection = await this.components.connectionManager.openConnection(oldContact.peerId, options);
154
176
  stream = await connection.newStream(this.protocol, options);
155
177
  const pb = pbStream(stream);
156
178
  await pb.write({
@@ -167,9 +189,9 @@ export class RoutingTable extends TypedEventEmitter {
167
189
  if (this.running && this.kb != null) {
168
190
  // only evict peers if we are still running, otherwise we evict
169
191
  // when dialing is cancelled due to shutdown in progress
170
- this.log.error('could not ping peer %p', oldContact.peer, err);
171
- this.log('evicting old contact after ping failed %p', oldContact.peer);
172
- this.kb.remove(oldContact.id);
192
+ this.log.error('could not ping peer %p', oldContact.peerId, err);
193
+ this.log('evicting old contact after ping failed %p', oldContact.peerId);
194
+ this.kb.remove(oldContact.kadId);
173
195
  }
174
196
  stream?.abort(err);
175
197
  return false;
@@ -178,14 +200,14 @@ export class RoutingTable extends TypedEventEmitter {
178
200
  this.metrics?.routingTableSize.update(this.size);
179
201
  }
180
202
  }, {
181
- peerId: oldContact.peer
203
+ peerId: oldContact.peerId
182
204
  });
183
205
  }));
184
206
  const responded = results
185
207
  .filter(res => res)
186
208
  .length;
187
209
  if (this.running && responded < oldContacts.length && this.kb != null) {
188
- this.log('adding new contact %p', newContact.peer);
210
+ this.log('adding new contact %p', newContact.peerId);
189
211
  this.kb.add(newContact);
190
212
  }
191
213
  }
@@ -204,43 +226,38 @@ export class RoutingTable extends TypedEventEmitter {
204
226
  */
205
227
  async find(peer) {
206
228
  const key = await utils.convertPeerId(peer);
207
- const closest = this.closestPeer(key);
208
- if (closest != null && peer.equals(closest)) {
209
- return closest;
210
- }
211
- return undefined;
229
+ return this.kb?.get(key)?.peerId;
212
230
  }
213
231
  /**
214
- * Retrieve the closest peers to the given key
232
+ * Retrieve the closest peers to the given kadId
215
233
  */
216
- closestPeer(key) {
217
- const res = this.closestPeers(key, 1);
234
+ closestPeer(kadId) {
235
+ const res = this.closestPeers(kadId, 1);
218
236
  if (res.length > 0) {
219
237
  return res[0];
220
238
  }
221
239
  return undefined;
222
240
  }
223
241
  /**
224
- * Retrieve the `count`-closest peers to the given key
242
+ * Retrieve the `count`-closest peers to the given kadId
225
243
  */
226
- closestPeers(key, count = this.kBucketSize) {
244
+ closestPeers(kadId, count = this.kBucketSize) {
227
245
  if (this.kb == null) {
228
246
  return [];
229
247
  }
230
- const closest = this.kb.closest(key, count);
231
- return closest.map(p => p.peer);
248
+ return [...this.kb.closest(kadId, count)];
232
249
  }
233
250
  /**
234
251
  * Add or update the routing table with the given peer
235
252
  */
236
- async add(peer) {
253
+ async add(peerId) {
237
254
  if (this.kb == null) {
238
255
  throw new Error('RoutingTable is not started');
239
256
  }
240
- const id = await utils.convertPeerId(peer);
241
- this.kb.add({ id, peer });
242
- this.log('added %p with kad id %b', peer, id);
243
- this.metrics?.routingTableSize.update(this.size);
257
+ const kadId = await utils.convertPeerId(peerId);
258
+ this.kb.add({ kadId, peerId });
259
+ this.log('added %p with kad id %b', peerId, kadId);
260
+ this.updateMetrics();
244
261
  }
245
262
  /**
246
263
  * Remove a given peer from the table
@@ -251,7 +268,32 @@ export class RoutingTable extends TypedEventEmitter {
251
268
  }
252
269
  const id = await utils.convertPeerId(peer);
253
270
  this.kb.remove(id);
254
- this.metrics?.routingTableSize.update(this.size);
271
+ this.updateMetrics();
272
+ }
273
+ updateMetrics() {
274
+ if (this.metrics == null || this.kb == null) {
275
+ return;
276
+ }
277
+ let size = 0;
278
+ let buckets = 0;
279
+ let maxDepth = 0;
280
+ function count(bucket) {
281
+ if (isLeafBucket(bucket)) {
282
+ if (bucket.depth > maxDepth) {
283
+ maxDepth = bucket.depth;
284
+ }
285
+ buckets++;
286
+ size += bucket.peers.length;
287
+ return;
288
+ }
289
+ count(bucket.left);
290
+ count(bucket.right);
291
+ }
292
+ count(this.kb.root);
293
+ this.metrics.routingTableSize.update(size);
294
+ this.metrics.routingTableKadBucketTotal.update(buckets);
295
+ this.metrics.routingTableKadBucketAverageOccupancy.update(Math.round(size / buckets));
296
+ this.metrics.routingTableKadBucketMaxDepth.update(maxDepth);
255
297
  }
256
298
  }
257
299
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routing-table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAA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AAG,OAAO,CAAC,CAAC,CAAA;QACrF,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC7D,CAAC;CACF"}
@@ -1,186 +1,151 @@
1
1
  import { TypedEventEmitter } from '@libp2p/interface';
2
2
  import type { PeerId } from '@libp2p/interface';
3
3
  export interface PingEventDetails {
4
- oldContacts: Contact[];
5
- newContact: Contact;
6
- }
7
- export interface UpdatedEventDetails {
8
- incumbent: Contact;
9
- selection: Contact;
4
+ oldContacts: Peer[];
5
+ newContact: Peer;
10
6
  }
11
7
  export interface KBucketEvents {
12
8
  'ping': CustomEvent<PingEventDetails>;
13
- 'added': CustomEvent<Contact>;
14
- 'removed': CustomEvent<Contact>;
15
- 'updated': CustomEvent<UpdatedEventDetails>;
9
+ 'added': CustomEvent<Peer>;
10
+ 'removed': CustomEvent<Peer>;
16
11
  }
17
12
  export interface KBucketOptions {
18
13
  /**
19
- * A Uint8Array representing the local node id
14
+ * The current peer. All subsequently added peers must have a KadID that is
15
+ * the same length as this peer.
20
16
  */
21
- localNodeId: Uint8Array;
17
+ localPeer: Peer;
22
18
  /**
23
- * The number of nodes that a k-bucket can contain before being full or split.
19
+ * How many bits of the key to use when forming the bucket trie. The larger
20
+ * this value, the deeper the tree will grow and the slower the lookups will
21
+ * be but the peers returned will be more specific to the key.
24
22
  */
25
- numberOfNodesPerKBucket?: number;
23
+ prefixLength: number;
26
24
  /**
27
- * The number of nodes to ping when a bucket that should not be split becomes
28
- * full. KBucket will emit a `ping` event that contains `numberOfNodesToPing`
29
- * nodes that have not been contacted the longest.
25
+ * The number of nodes that a max-depth k-bucket can contain before being
26
+ * full.
27
+ *
28
+ * @default 20
30
29
  */
31
- numberOfNodesToPing?: number;
30
+ kBucketSize?: number;
32
31
  /**
33
- * An optional `distance` function that gets two `id` Uint8Arrays and return
34
- * distance (as number) between them.
32
+ * The number of nodes that an intermediate k-bucket can contain before being
33
+ * split.
34
+ *
35
+ * @default kBucketSize
35
36
  */
36
- distance?(a: Uint8Array, b: Uint8Array): number;
37
+ splitThreshold?: number;
37
38
  /**
38
- * An optional `arbiter` function that given two `contact` objects with the
39
- * same `id` returns the desired object to be used for updating the k-bucket.
40
- * For more details, see [arbiter function](#arbiter-function).
39
+ * The number of nodes to ping when a bucket that should not be split becomes
40
+ * full. KBucket will emit a `ping` event that contains `numberOfNodesToPing`
41
+ * nodes that have not been contacted the longest.
41
42
  */
42
- arbiter?(incumbent: Contact, candidate: Contact): Contact;
43
+ numberOfNodesToPing?: number;
43
44
  }
44
- export interface Contact {
45
- id: Uint8Array;
46
- peer: PeerId;
47
- vectorClock?: number;
45
+ export interface Peer {
46
+ kadId: Uint8Array;
47
+ peerId: PeerId;
48
48
  }
49
- export interface Bucket {
50
- id: Uint8Array;
51
- contacts: Contact[];
52
- dontSplit: boolean;
49
+ export interface LeafBucket {
50
+ prefix: string;
51
+ depth: number;
52
+ peers: Peer[];
53
+ }
54
+ export interface InternalBucket {
55
+ prefix: string;
56
+ depth: number;
53
57
  left: Bucket;
54
58
  right: Bucket;
55
59
  }
60
+ export type Bucket = LeafBucket | InternalBucket;
61
+ export declare function isLeafBucket(obj: any): obj is LeafBucket;
56
62
  /**
57
- * Implementation of a Kademlia DHT k-bucket used for storing
58
- * contact (peer node) information.
63
+ * Implementation of a Kademlia DHT routing table as a prefix binary trie with
64
+ * configurable prefix length, bucket split threshold and size.
59
65
  */
60
66
  export declare class KBucket extends TypedEventEmitter<KBucketEvents> {
61
- localNodeId: Uint8Array;
62
67
  root: Bucket;
63
- private readonly numberOfNodesPerKBucket;
68
+ localPeer: Peer;
69
+ private readonly prefixLength;
70
+ private readonly splitThreshold;
71
+ private readonly kBucketSize;
64
72
  private readonly numberOfNodesToPing;
65
- private readonly distance;
66
- private readonly arbiter;
67
73
  constructor(options: KBucketOptions);
68
- /**
69
- * Default arbiter function for contacts with the same id. Uses
70
- * contact.vectorClock to select which contact to update the k-bucket with.
71
- * Contact with larger vectorClock field will be selected. If vectorClock is
72
- * the same, candidate will be selected.
73
- *
74
- * @param {object} incumbent - Contact currently stored in the k-bucket.
75
- * @param {object} candidate - Contact being added to the k-bucket.
76
- * @returns {object} Contact to updated the k-bucket with.
77
- */
78
- static arbiter(incumbent: Contact, candidate: Contact): Contact;
79
- /**
80
- * Default distance function. Finds the XOR
81
- * distance between firstId and secondId.
82
- *
83
- * @param {Uint8Array} firstId - Uint8Array containing first id.
84
- * @param {Uint8Array} secondId - Uint8Array containing second id.
85
- * @returns {number} Integer The XOR distance between firstId and secondId.
86
- */
87
- static distance(firstId: Uint8Array, secondId: Uint8Array): number;
88
74
  /**
89
75
  * Adds a contact to the k-bucket.
90
76
  *
91
- * @param {object} contact - the contact object to add
77
+ * @param {Peer} peer - the contact object to add
92
78
  */
93
- add(contact: Contact): KBucket;
79
+ add(peer: Peer): void;
94
80
  /**
95
- * Get the n closest contacts to the provided node id. "Closest" here means:
81
+ * Get 0-n closest contacts to the provided node id. "Closest" here means:
96
82
  * closest according to the XOR metric of the contact node id.
97
83
  *
98
84
  * @param {Uint8Array} id - Contact node id
99
- * @param {number} n - Integer (Default: Infinity) The maximum number of closest contacts to return
100
- * @returns {Array} Array Maximum of n closest contacts to the node id
85
+ * @returns {Generator<Peer, void, undefined>} Array Maximum of n closest contacts to the node id
101
86
  */
102
- closest(id: Uint8Array, n?: number): Contact[];
87
+ closest(id: Uint8Array, n?: number): Generator<PeerId, void, undefined>;
103
88
  /**
104
89
  * Counts the total number of contacts in the tree.
105
90
  *
106
91
  * @returns {number} The number of contacts held in the tree
107
92
  */
108
93
  count(): number;
109
- /**
110
- * Determines whether the id at the bitIndex is 0 or 1.
111
- * Return left leaf if `id` at `bitIndex` is 0, right leaf otherwise
112
- *
113
- * @param {object} node - internal object that has 2 leafs: left and right
114
- * @param {Uint8Array} id - Id to compare localNodeId with.
115
- * @param {number} bitIndex - Integer (Default: 0) The bit index to which bit to check in the id Uint8Array.
116
- * @returns {object} left leaf if id at bitIndex is 0, right leaf otherwise.
117
- */
118
- _determineNode(node: any, id: Uint8Array, bitIndex: number): Bucket;
119
94
  /**
120
95
  * Get a contact by its exact ID.
121
96
  * If this is a leaf, loop through the bucket contents and return the correct
122
97
  * contact if we have it or null if not. If this is an inner node, determine
123
98
  * which branch of the tree to traverse and repeat.
124
99
  *
125
- * @param {Uint8Array} id - The ID of the contact to fetch.
126
- * @returns {object | null} The contact if available, otherwise null
100
+ * @param {Uint8Array} kadId - The ID of the contact to fetch.
101
+ * @returns {object | undefined} The contact if available, otherwise null
127
102
  */
128
- get(id: Uint8Array): Contact | undefined;
103
+ get(kadId: Uint8Array): Peer | undefined;
129
104
  /**
130
- * Returns the index of the contact with provided
131
- * id if it exists, returns -1 otherwise.
105
+ * Removes contact with the provided id.
132
106
  *
133
- * @param {object} node - internal object that has 2 leafs: left and right
134
- * @param {Uint8Array} id - Contact node id.
135
- * @returns {number} Integer Index of contact with provided id if it exists, -1 otherwise.
107
+ * @param {Uint8Array} kadId - The ID of the contact to remove
136
108
  */
137
- _indexOf(node: Bucket, id: Uint8Array): number;
109
+ remove(kadId: Uint8Array): void;
138
110
  /**
139
- * Removes contact with the provided id.
111
+ * Similar to `toArray()` but instead of buffering everything up into an
112
+ * array before returning it, yields contacts as they are encountered while
113
+ * walking the tree.
140
114
  *
141
- * @param {Uint8Array} id - The ID of the contact to remove
142
- * @returns {object} The k-bucket itself
115
+ * @returns {Iterable} All of the contacts in the tree, as an iterable
143
116
  */
144
- remove(id: Uint8Array): KBucket;
117
+ toIterable(): Generator<Peer, void, undefined>;
145
118
  /**
146
- * Splits the node, redistributes contacts to the new nodes, and marks the
147
- * node that was split as an inner node of the binary tree of nodes by
148
- * setting this.root.contacts = null
119
+ * Default distance function. Finds the XOR distance between firstId and
120
+ * secondId.
149
121
  *
150
- * @param {object} node - node for splitting
151
- * @param {number} bitIndex - the bitIndex to which byte to check in the Uint8Array for navigating the binary tree
122
+ * @param {Uint8Array} firstId - Uint8Array containing first id.
123
+ * @param {Uint8Array} secondId - Uint8Array containing second id.
124
+ * @returns {number} Integer The XOR distance between firstId and secondId.
152
125
  */
153
- _split(node: Bucket, bitIndex: number): void;
126
+ distance(firstId: Uint8Array, secondId: Uint8Array): bigint;
154
127
  /**
155
- * Returns all the contacts contained in the tree as an array.
156
- * If this is a leaf, return a copy of the bucket. If this is not a leaf,
157
- * return the union of the low and high branches (themselves also as arrays).
128
+ * Determines whether the id at the bitIndex is 0 or 1
129
+ * Return left leaf if `id` at `bitIndex` is 0, right leaf otherwise
158
130
  *
159
- * @returns {Array} All of the contacts in the tree, as an array
131
+ * @param {Uint8Array} kadId - Id to compare localNodeId with
132
+ * @returns {LeafBucket} left leaf if id at bitIndex is 0, right leaf otherwise.
160
133
  */
161
- toArray(): Contact[];
134
+ private _determineBucket;
162
135
  /**
163
- * Similar to `toArray()` but instead of buffering everything up into an
164
- * array before returning it, yields contacts as they are encountered while
165
- * walking the tree.
136
+ * Returns the index of the contact with provided
137
+ * id if it exists, returns -1 otherwise.
166
138
  *
167
- * @returns {Iterable} All of the contacts in the tree, as an iterable
139
+ * @param {object} bucket - internal object that has 2 leafs: left and right
140
+ * @param {Uint8Array} kadId - KadId of peer
141
+ * @returns {number} Integer Index of contact with provided id if it exists, -1 otherwise.
168
142
  */
169
- toIterable(): Iterable<Contact>;
143
+ private _indexOf;
170
144
  /**
171
- * Updates the contact selected by the arbiter.
172
- * If the selection is our old contact and the candidate is some new contact
173
- * then the new contact is abandoned (not added).
174
- * If the selection is our old contact and the candidate is our old contact
175
- * then we are refreshing the contact and it is marked as most recently
176
- * contacted (by being moved to the right/end of the bucket array).
177
- * If the selection is our new contact, the old contact is removed and the new
178
- * contact is marked as most recently contacted.
145
+ * Modify the bucket, turn it from a leaf bucket to an internal bucket
179
146
  *
180
- * @param {object} node - internal object that has 2 leafs: left and right
181
- * @param {number} index - the index in the bucket where contact exists (index has already been computed in a previous calculation)
182
- * @param {object} contact - The contact object to update
147
+ * @param {any} bucket - bucket for splitting
183
148
  */
184
- _update(node: Bucket, index: number, contact: Contact): void;
149
+ private _split;
185
150
  }
186
151
  //# sourceMappingURL=k-bucket.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"k-bucket.d.ts","sourceRoot":"","sources":["../../../src/routing-table/k-bucket.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AA4B/C,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,EAAE,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;IACrC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7B,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC/B,SAAS,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,EAAE,UAAU,CAAA;IAEvB;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAEhC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;;OAGG;IACH,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;IAE/C;;;;OAIG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAA;CAC1D;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,UAAU,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,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