-
Notifications
You must be signed in to change notification settings - Fork 8
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
Renaming controller_run_result
#107
Comments
For future readers, see my comment in #106 for my thoughts on how we could do this with a session object. I think there is an interesting issue around how we deal with client controllers. It makes sense for the server one to be a factory if it sets up the routes and they're static one its starts, but the client controller needs to be able to dynamically make new requests. What we could do is have the controller factory and the session both expose the same api for making requests, but then we have to write the same api twice and maintain both versions, unless we want to inherit from some base which I am conflicted about since imo it is an abuse of inheritance but it is also used in stuff like beast (message inherits from header for example) and would let us provide that factory version on the client side while preserving the dynamic stuff |
I've been thinking a bit more on this, and I came up with another option: make the client api start the runner on construction. For example, make the To avoid duplication across the client and server, we could use template-based dependency injection to abstract the provider of the io context and thread spawning, this would have the added bonus of letting users specify their own way to run the io context and have direct access to it (although how this interacts with the work guard is something that still needs thinking about imo) Whether we go this second route or not, I think we need to very carefully consider if we want to allow both the setup and run behavior and the run then setup usage. |
I like your approach. @0x00002a are you able to spin up a draft for this? |
I'll take a crack at it today, probably won't get very far but should at least get more of an idea of the issues |
I've got through a bit of this proof of concept, but I am feeling a little afraid I'm making such a massive change, my implementation has removed the server controller and made Maybe it would be better to just rename them, I'm worried I'm making substantual changes which arn't needed :p. Any thoughts? |
That's definitely what I had on mind from the beginning :p |
@Tectu How about keeping |
@0x00002a that sounds reasonable. I wouldn't even mind |
Related to #106 and #107. * feat: make controller_run_result movable * chore: improve tests slightly * fix: accidental removal of m_workguard from controller_run_result This actually was informative because it showed how m_workguard actually does matter. See if there is no work guard, and the user calls run() on a _client_ controller, then enough time elapses so that all work is complete and there is a pause before new work is added, the io_context::run() will return for each of the threads, meaning that in actual fact queuing more actions via the controller (which is valid after calling start) would not actually do anything. tl;dr nasty obscure bug, keep the workguard its needed for clients * feat: add start_result alias to controllers * coding style * chore: start_result -> session * chore: server::controller -> server::routing_context * chore: server/controller -> server/routing_context * fix: tests include * fix: more rename fixes * fix: session test * fix example server/applications/demo01 Co-authored-by: Joel Bodenmann <jbo@insane.engineer>
@0x00002a I've been thinking about this (again): Why not just renaming |
I'm really not happy with the naming scheme used by the newly introduced
controller_run_result
. It doesn't really reflect the design of the system appropriately in my opinion.I'd propose renaming
controller_run_result
to justcontroller
and renaming the currentcontroller
class tocontroller_factory
.@0x00002a Thoughts?
The text was updated successfully, but these errors were encountered: