Skip to content

Conversation

@guillaumemichel
Copy link
Collaborator

@guillaumemichel guillaumemichel commented Jul 24, 2025

Part of #1095

Depends on #1115


The provider schedule (introduced in follow up PR) stores a mapping prefix -> timestamp, corresponding to the time at which a keyspace region represented by its prefix should be reprovided. When reproviding a region, all keys matching the region's prefix will be reprovided.

Whenever users want to provide a key with StartProviding, if no prefix of the key is in the schedule yet, we take a prefix of the key whose length is the average of the prefixes already in the schedule (assume the keyspace region has the same peers population density as the average population density in teh DHT swarm).

When the schedule is empty, we make a couple GetClosestPeers requests in order to have an approximation of the network size, helping to determine the initial prefix length to be used in the schedule.

Note that no network provide can happen before measureInitialPrefixLen has completed. measureInitialPrefixLen will block until GetClosestPeers return some peers, so it requires the node to have a connection, and the router (DHT client) to be bootstrapped. Anyway, if the DHT client isn't bootstrapped, no provide operation can succeed.

@guillaumemichel guillaumemichel requested a review from a team as a code owner July 24, 2025 10:34
This was referenced Jul 24, 2025
@guillaumemichel guillaumemichel changed the base branch from provider-network-ops to provider August 5, 2025 11:58
@guillaumemichel guillaumemichel merged commit 94a515d into provider Aug 13, 2025
9 checks passed
@guillaumemichel guillaumemichel deleted the provider-prefixlen branch August 13, 2025 08:00
guillaumemichel added a commit that referenced this pull request Aug 19, 2025
* provider: adding provide and reprovide queue

* provider: network operations

* add some tests

* schedule prefix len computations

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* close avgPrefixLenReady to signal initialPrefixLen measurement is done
guillaumemichel added a commit to guillaumemichel/go-libp2p-kad-dht that referenced this pull request Sep 17, 2025
* provider: adding provide and reprovide queue

* provider: network operations

* add some tests

* schedule prefix len computations

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* close avgPrefixLenReady to signal initialPrefixLen measurement is done
guillaumemichel added a commit that referenced this pull request Sep 17, 2025
* provider: adding provide and reprovide queue

* provider: network operations

* add some tests

* schedule prefix len computations

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* close avgPrefixLenReady to signal initialPrefixLen measurement is done
guillaumemichel added a commit that referenced this pull request Sep 18, 2025
* provider: adding provide and reprovide queue

* provider: network operations

* add some tests

* schedule prefix len computations

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* close avgPrefixLenReady to signal initialPrefixLen measurement is done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants