-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use Axum-style State Management #133
Comments
TowerTower is a Rust crate which is centred around the following signature (all three types are generic): async fn(Request) -> Result<Response, Error> This signature is the primary reason for having a Tower LayerLayers are a way to "wrap" services, and add functionality outside of the service itself. For example, suppose I wanted to log all "Request"s of some type. Note: I can either pass the request through as suggested, or, modify it before passing it to the next layer/service. This emulates what I was trying to do with #122 , wherein I wrote a diagram like this:
I have since understood that this can be done in Tower terms (without state) like so:
Want to add logging? Cool, just define your I hope I'm making sense. Everything becomes a layer, service, extension, piece of state, etc. State is not handled inherently by Starting to formulate what we'll need for good state management here, as I suspect that will be its own Layer(?) or something like that? Still working on it. |
State management is an extremely difficult problem for screen readers. Axum's method of handling state is somehow quite ingenious. Especially since we could run multiple handlers concurrently (or in parallel) and lock with sync primitives.
I'd like to implement something similar. I think this would be a great step for Odilia in terms of maintainability. And, it avoids (kind of) having global state. It at least allows me to capture partial state when needed :)
In a previous attempt at handling state, I came up with #120 , which did solve the state management issue, but it introduced an entire set of its own problems. The primary one being that it is extremely rigid, and requires adding structure members just to change what is accepted by each event handler. I got a lot of pushback for this idea, since, although it does kind of work... it introduces a significant barrier in development not likely to be cleaned up quickly. This is objectively a better system, if I can somehow figure out how to implement it.
The text was updated successfully, but these errors were encountered: