-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
core/node: add configuration options for Bitswap via fx #9258
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I like strong type checking.
(becarefull I didn't wrote correct syntax in my suggestions)
- This doesn't do what we asked really.
If I call:
fx.Supply(bitswap.WithTracer(tracer)),
fx.Supply(bitswap.TaskWorkerCount(2000)),
They wont get joined into one slice.
If you use the struct tags @ajnavarro linked you can make fx
collect them for you.
aha! Yeah, as I said, no clue how fx works :) I'll get to it |
@mrd0ll4r if you really don't know how to do that no problem, I can make a PoC on this PR that you will cleanup 🙂. |
ebc1987
to
ff6b1c8
Compare
core/node/bitswap.go
Outdated
// Additional options to bitswap.New can be provided via the "bitswap-options" | ||
// group. | ||
func OnlineExchange() fx.Option { | ||
return fx.Provide(func(in onlineExchangeIn, lc fx.Lifecycle) exchange.Interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I saw somewhere that fx.Lifecycle
was provided outside of an In
struct. Let me know if that's the right way or not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you moving fx.Provide
inside the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I asked for it, I I like type safety (returning fx.Option
is imo clearer than interface{}
).
Maybe it's less clear because you don't really what each option do (then we should rename it to ProvideOnlineExchange
maybe ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not disagree with you, but everywhere else fx.Provide
is called outside. I think we should keep code consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this back to have fx.Provide
outside the function.
PTAL |
I have re-requested review from @Jorropo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll leave the final word for @ajnavarro because I'm not totaly sure of what are the FX conventions.
ff6b1c8
to
4056765
Compare
4056765
to
826c79c
Compare
Rebased, updated to move |
Fixes #9256