Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move coord packages to internal #933

Merged
merged 5 commits into from
Sep 20, 2023
Merged

Conversation

iand
Copy link

@iand iand commented Sep 20, 2023

Moved coord and sub packages to internal to reduce API surface and allow more radical refactoring in the future.

Need to double-check that no internal types are expected in method signatures or return values in the v2 root package

Branched from #932 since that touched a lot of the same packages


import "fmt"

// A ConfigurationError is returned when a component's configuration is found to be invalid or unusable.
Copy link
Author

Choose a reason for hiding this comment

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

I think we should be using typed errors throughout so I brought this over from go-kademlia

@iand iand changed the title V2 coord internal Move coord and kadt packages to internal Sep 20, 2023
@iand iand added the v2 All issues related to the v2 rewrite label Sep 20, 2023
"github.com/libp2p/go-libp2p-kad-dht/v2/coord"
"github.com/libp2p/go-libp2p-kad-dht/v2/coord/routing"
"github.com/libp2p/go-libp2p-kad-dht/v2/kadt"
"github.com/libp2p/go-libp2p-kad-dht/v2/internal/coord/routing"
Copy link
Author

Choose a reason for hiding this comment

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

Used for the Routing Table. I need to replicate the necessary interface here

Copy link
Author

Choose a reason for hiding this comment

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

Defined interface in kadt package since it is part of the bridge between libp2p and go-kademlia types

@iand iand self-assigned this Sep 20, 2023
@iand iand changed the title Move coord and kadt packages to internal Move coord packages to internal Sep 20, 2023
@iand
Copy link
Author

iand commented Sep 20, 2023

Had to move kadt back out of internal since the RoutingTable uses kadt.Key and kadt.PeerID so clients supplying their own routing table implementation need access to those types too.

@iand iand marked this pull request as ready for review September 20, 2023 11:45
@iand iand merged commit 13934e2 into v2-routing-getvalue2 Sep 20, 2023
11 checks passed
@iand iand deleted the v2-coord-internal branch September 20, 2023 11:45
iand added a commit that referenced this pull request Sep 21, 2023
* Improve query capabilities

* go mod tidy

* Review feedback

* go mod tidy

* Move coord packages to internal (#933)

* Move coord and kadt packages to internal

* go mod tidy

* go fmt

* Move kadt out of internal and add RoutingTable interface
iand added a commit that referenced this pull request Sep 25, 2023
* Improve query capabilities

* go mod tidy

* Review feedback

* go mod tidy

* Move coord packages to internal (#933)

* Move coord and kadt packages to internal

* go mod tidy

* go fmt

* Move kadt out of internal and add RoutingTable interface

* Add explore state machine to expand population of routing table

* Refactor schedule into separate type

* Add generation of random peer id for a given cpl

* go mod tidy

* Add prefixmap generator

* Use constants for various query ids

* go mod tidy

* Wire explore state machine into routing behaviour

* Remove some unnecessary conversions

* PR review updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 All issues related to the v2 rewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants