-
Notifications
You must be signed in to change notification settings - Fork 57
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: start moving discovery modules to waku/discovery #2587
Conversation
You can find the image built from this PR at
Built from 8163a49 |
I wonder if discovery should enter at the node layer, or if it belongs to the "middleware" layer we talked about when creating the factory. Definitely love the idea of having a discovery manager :) Having the discovery logic in its own module is a great step 🤩 |
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.
Yes, I think it is a good step for restructure.
The only thing if sthg was changed in formatting as seemingly there are changes related only for that purpose without any meaningful change?
But it's ok, manageable.
Very good point! How do you feel about having the following? Does it sound correct?
|
It's true that both the There's a chance that the @jm-clius what's your take on it? |
While having a Discovery Manager makes sense from a code org POV, I wouldn't compose it into the node object. In fact, we've specifically moved discovery elements out of the node as we realised more and more that we needed the separate layer of abstraction (side note: we've also seriously considered moving peer management outside of the node object, even though it is indeed at a lower abstraction than the discovery manager). In general:
The composition of the above is what makes a Waku application. Afaics the role of the node factory is exactly to assist with the composition of all these elements, so this is where the DiscoverManager would belong. IMO it would be a mistake to blur the lines of separation here. |
6f2df40
to
a43a4b7
Compare
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.
Looks amazing! Thanks so much! 😍
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.
Thanks for this! The code organisation makes sense - also to include discovery functions in the factory from where it can be encapsulated by the bindings. Not sure yet I see the advantage why somewhat disparate objects would be composed into a single object, DiscoveryManager
, though. Approving, as I assume it will make more sense in a future PR. :D
Description
We need to allow
nwaku
features to be accessible from bothwakunode2
andlibwaku
. In this PR, we start movingdiscovery
logic fromwakunode2
app to a more generic location,waku/node/discovery_manager
.In future PRs, is likely that we will perform the following movements:
wakuDiscv5
anddynamicBootstrapNodes
, see this, will get controlled only byDiscoveryManager
.WakuNode
object will contain a reference todiscoveryManager
, similarly to how it now contains a reference topeerManager
. See:nwaku/waku/node/waku_node.nim
Lines 84 to 85 in 4117fe6
Notice that the
discoveryManager
module is aimed to contain the logic to handle the discovery of other peers plus the logic to make the "self" node discoverable by others.Issue
migrate DiscV5 and DNS Discovery from app.nim to waku_node.nim: #2452