Skip to content

Conversation

guillaumemichel
Copy link
Collaborator

Closes #1145

Part of #1095

Supersedes #1148

Summary

Introduces a wrapper around the SweepingProvider queuing operations and processing them by batches.

This allows users (such as Kubo) of this new buffered.SweepingProvider to have a fully async (and fast!) SweepingProvider.

The queue implementation is go-dsqueue.

This solution keeps queuing complexity out of the SweepingProvider implementation, and makes the queue optional.

Since this is a wrapper, it can wrap either provider.SweepingProvider or dual.SweepingProvider (dual DHT provider).

Alternatives

#1148 (draft) also implements queuing but has the following drawbacks:

  • Queue fully in memory (vs in datastore here)
  • Increased code complexity
  • More of provider.SweepingProvider internal need to be exposed for the dual DHT provider

Minor changes

  • Moved dual/provider to provider/dual so that it can access provider/internal.

@guillaumemichel guillaumemichel requested review from a team as code owners September 14, 2025 16:12
@guillaumemichel guillaumemichel mentioned this pull request Sep 14, 2025
56 tasks
Copy link
Collaborator Author

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes for myself

Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK. Have a couple of questions.

Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from provider-accelerate-keystore to provider September 16, 2025 15:12
@guillaumemichel guillaumemichel merged commit 0d5f2b2 into provider Sep 16, 2025
9 checks passed
@guillaumemichel guillaumemichel deleted the buffered-provider branch September 16, 2025 15:14
guillaumemichel added a commit to guillaumemichel/go-libp2p-kad-dht that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code

* buffered provider

* tests

* removing redundant code

* docs

* wait on empty queue

* fix flaky test
guillaumemichel added a commit to guillaumemichel/go-libp2p-kad-dht that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code

* buffered provider

* tests

* removing redundant code

* docs

* wait on empty queue

* fix flaky test
guillaumemichel added a commit that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code

* buffered provider

* tests

* removing redundant code

* docs

* wait on empty queue

* fix flaky test
guillaumemichel added a commit that referenced this pull request Sep 17, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code

* buffered provider

* tests

* removing redundant code

* docs

* wait on empty queue

* fix flaky test
guillaumemichel added a commit that referenced this pull request Sep 18, 2025
* provider: ResettableKeyStore

* keystore: remove mutex

* use datastore namespace

* don't sync to write to altDs

* simplify put

* deduplicate operation execution code

* buffered provider

* tests

* removing redundant code

* docs

* wait on empty queue

* fix flaky test
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.

2 participants