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

chore: named injection for components with a common interface #628

Open
ata-nas opened this issue Feb 10, 2025 · 0 comments
Open

chore: named injection for components with a common interface #628

ata-nas opened this issue Feb 10, 2025 · 0 comments
Labels
Block Node Issues/PR related to the Block Node.

Comments

@ata-nas
Copy link
Contributor

ata-nas commented Feb 10, 2025

Persona

As a Block Node Developer

Request

I want to use @Named injection with Dagger

Goal

So that I can have components that share an interface be injectable

Technical Notes

Currently there exist components that are different in nature/logic which share an interface, for instance the persistence handler and the verification handler are both a BlockNodeEventHandler so they can work with the ring buffer.
This does not allow for injection of any BlockNodeEventHandler by default.
Different injection targets need to be somehow distinguished.
A way to do that is by using the @Named annotation which would allow Dagger to wire multiple implementations with the same interface.
These then could be injected as the interface they implement in the appropriate places using the @Named qualifier again.

We need to:

  • identify all such components, example is the persistence handler and the verification handler which are both BlockNodeEventHandler
  • migrate the current injection logic to leverage the @Named qualifier approach
@ata-nas ata-nas added the Block Node Issues/PR related to the Block Node. label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Node Issues/PR related to the Block Node.
Projects
None yet
Development

No branches or pull requests

1 participant