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

refactor: document and expose Amino DHT defaults #990

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

lidel
Copy link
Member

@lidel lidel commented Sep 19, 2024

The intention here is to have github.com/libp2p/go-libp2p-kad-dht/amino as a single public source of truth about Amino DHT we can reference rather than hardcoding the same defaults everywhere in IPFS implementations (boxo, kubo etc).

the intention here is to have public source of truth we can reference
rather than hardcoding the same amino defaults everywhere
@lidel lidel requested review from guillaumemichel and a team as code owners September 19, 2024 20:55
Copy link
Contributor

@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.

Looks good, thanks @lidel

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.

Looks good. Couple of questions.

@@ -20,7 +21,7 @@ type options struct {
// defaults are the default crawler options. This option will be automatically
// prepended to any options you pass to the crawler constructor.
var defaults = func(o *options) error {
o.protocols = []protocol.ID{"/ipfs/kad/1.0.0"}
o.protocols = amino.Protocols
o.parallelism = 1000
o.connectTimeout = time.Second * 5
o.perMsgTimeout = time.Second * 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be defined in defaults.go as well, even if not exported?

Copy link
Member Author

Choose a reason for hiding this comment

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

These seem to be specific to crawler and really part of "Amino DHT contract", so could
I'm going to merge thus PR as-is, we can figure out what to do remaining magic numbers in follow-up PR.

o.Resiliency = 3
o.BucketSize = amino.DefaultBucketSize
o.Concurrency = amino.DefaultConcurrency
o.Resiliency = amino.DefaultResiliency
o.LookupCheckConcurrency = 256
Copy link
Contributor

Choose a reason for hiding this comment

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

Another candidate for defaults? Also, wish there was some explanation why 256 is the chosen value for concurrency.

@lidel lidel merged commit 084d574 into master Nov 13, 2024
11 checks passed
@lidel lidel deleted the refactor/explicit-amino-defaults branch November 13, 2024 18:46
@lidel lidel mentioned this pull request Nov 13, 2024
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