-
Notifications
You must be signed in to change notification settings - Fork 107
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
driver: separate controller and node structs #458
base: master
Are you sure you want to change the base?
driver: separate controller and node structs #458
Conversation
@timoreimann I have not made any changes to the tests but wanted to seek your feedback on the approach I was taking. I embedded the Driver object into the Controller and the Node structs. I am instantiating the Controller and Node using their constructors from main.go but it definitely looks like calling 3 separate Run() is not a smart way to go.
|
b7f9fe8
to
3a809b9
Compare
Hey @dhij 👋 What I think we could do to DRY out the logic is use a variable only used for one of the services / modes as a trigger to distinguish. For us, that could be the token: it is only ever set in Controller mode, and without it we must be running in Node mode. That way, we can define two separate structs that each have a Does that make sense? |
Quick addendum to my previous comment: the distinction between which struct to use and return (controller vs node) can probably be made in Existing methods for the corresponding services (living in |
@timoreimann 👋 Timo, yes that makes sense! Just to clarify on the last sentence in your first comment where you said |
Yes, that's what I had in mind. This shared struct can probably mostly be what the driver is today, so the primary effort may boil down to extracting service-specific variables / fields and methods. |
@timoreimann What I have in mind right now are:
Please correct me if the idea above is different from what you had in mind! Also I read your comment again and wasn't sure what you meant here: |
If Looking at the current I'm slightly leaning towards the second approach, though IMHO it often takes an attempt to implement to judge for sure. I'd appreciate if you could try things out and report back on how you feel about it. (Feel also free to push to your branch to review potentially even very unfinished solutions.)
The methods in these files are mostly receivers to the Let me know if these answers are helpful. |
@timoreimann The second approach seems like a good idea, and the answers helped a lot thank you! I will try things out and get back to you! |
3a809b9
to
f009c37
Compare
👋 @timoreimann I just pushed a commit where we will be using the same
I noticed some fields such as the I would appreciate any feedback 🙂 |
Issue #207
This PR separates the controller and the node parts from the driver struct.