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

node: enhance DI allowing overriding of dependencies #290

Merged
merged 10 commits into from
Dec 24, 2021
Merged

Conversation

Wondertan
Copy link
Member

@Wondertan Wondertan commented Dec 15, 2021

About

This is a solution for #285. It is different from the design there, as it's not possible. Finding the other solution took a lot of time, sketching, and learning. The reason why is the limitation of FX described in uber-go/fx#825. This PR solves the problem by extending fxutil lib to mimic fx functionality + new OverrideSupply option described in uber-go/fx#825. In future, the code of fxutil might be deleted once the described fx feature is implemented and merged.

This PR might be difficult to understand in detail as it involves reflection + understanding of the DI itself, but also a good opportunity to understand how both worlds work for the implementer and for the reviewers.

Changes

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

Yeah let's have a call about this

node/p2p/identity.go Show resolved Hide resolved
renaynay
renaynay previously approved these changes Dec 23, 2021
Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

Please leave a comment in the options.go file that references the issue from uber/fxutil and mention that this code is intended to be deleted upon implementation in upstream.

Bidon15
Bidon15 previously approved these changes Dec 24, 2021
@Wondertan Wondertan merged commit 3ab2919 into main Dec 24, 2021
@Wondertan Wondertan deleted the hlib/fxutil branch December 24, 2021 11:12
@Wondertan Wondertan restored the hlib/fxutil branch January 7, 2022 14:40
@Wondertan Wondertan deleted the hlib/fxutil branch January 7, 2022 15:56
Bidon15 pushed a commit to Bidon15/celestia-node that referenced this pull request Jan 11, 2022
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