rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

kad: make bucket size configurable

Open guillaumemichel opened this issue 9 months ago • 6 comments

Description

The bucket size should be customizable to fit the needs of kad's users. Currently the bucket size is bound to the static K_VALUE which is a constant (20 by default).

Motivation

The bucket size is a system parameter that must be adjusted to a network's need. 20 is the default value used in the IPFS DHT, but discv5 (not using libp2p) has a bucket size of 16 for instance. The bucket size should be configurable.

Current Implementation

The current bucket size if defined to be the K_VALUE constant also used for other purposes, and the value must be manually modified to change the bucket size, which is far from ideal.

This will likely be a breaking change since the KBucketsTable::new should probably be modified to accept the bucket size as additional parameter or in a Config.

Are you planning to do it yourself in a pull request ?

Yes

guillaumemichel avatar May 15 '24 13:05 guillaumemichel