Skip to content

Conversation

@guillaumemichel
Copy link
Collaborator

@guillaumemichel guillaumemichel commented Jul 24, 2025

Part of #1095

Depends on #1116


Schedule

The crux of the Reprovide Sweep is to hold a schedule to know when to reprovide parts of the keyspace to avoid the burst of reproviding everything at once.

The schedule is a datastructure storing the prefixes associated with the explored keyspace regions, and the time for which they should be reprovided next. The schedule contains no overlapping prefix (e.g no prefix included in the schedule is a superstring of another prefix in the schedule).

The schedule only contains the keyspace regions for which the provider is (re)providing keys. E.g if the provider is only reproviding a single key, the schedule will contain a single region, whose identifier is a prefix of this key.

Provide Cycle

  • The ReprovideInterval determine the duration of the provide cycle.
  • Each region is reprovided exactly once every cycle.
  • Regions reprovides are spread all over the cycle.
  • If there are 4 prefixes, the schedule would look like this:
    • 00 at time offset 0
    • 01 at time offset ReprovideInterval / 4
    • 10 at time offset ReprovideInterval / 2
    • 11 at time offset 3 * ReprovideInterval / 4

The time at which a keys matching a region should be reprovided is not a timestamp, but a time offset compared to the provide cycle. The provide cycle starts when the SweepingProvider is initialized.

@guillaumemichel guillaumemichel requested a review from a team as a code owner July 24, 2025 12:25
@guillaumemichel guillaumemichel mentioned this pull request Jul 24, 2025
56 tasks
Base automatically changed from provider-prefixlen to provider August 13, 2025 08:00
@guillaumemichel guillaumemichel merged commit 7f25057 into provider Aug 13, 2025
9 checks passed
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

* provider schedule

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* address review

* satisfy linter

* simplify unscheduleSubsumedPrefixesNoClock

* moved maxPrefixSize const to top
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

* provider schedule

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* address review

* satisfy linter

* simplify unscheduleSubsumedPrefixesNoClock

* moved maxPrefixSize const to top
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

* provider schedule

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* address review

* satisfy linter

* simplify unscheduleSubsumedPrefixesNoClock

* moved maxPrefixSize const to top
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

* provider schedule

* addressed review

* use go-test/random

* satisfy linter

* log errors during initial prefix len measurement

* address review

* satisfy linter

* simplify unscheduleSubsumedPrefixesNoClock

* moved maxPrefixSize const to top
@gammazero gammazero deleted the provider-schedule branch November 7, 2025 19:49
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