-
Notifications
You must be signed in to change notification settings - Fork 4
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
Store request #28
Store request #28
Conversation
Fix comments, hide certain commands, add aliases
Include all migrations using include_dir Cleanup imports
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.
- lots of
.unwrap
s in the handlers but i assume these will be fixed later - we should also use concrete return types in handlers instead of the
impl IntoResponse
- good job on switching over to the
api.rs + api module
instead ofapi module + mod.rs
|
||
#[tracing::instrument(skip_all)] | ||
pub async fn inspect_request_handler( | ||
State(ApiState { |
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.
i think it'd be cleaner if we used State(inspector_service): State<Arc<InspectorService>>
instead of desugaring the ApiState
, or is that not possible here?
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.
It is only possible to use 1 State object. In our case that is the ApiState
with all of the references to the other components.
We can do this FromRef
trick from the docs: https://docs.rs/axum/latest/axum/extract/struct.State.html#substates
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.
I have added it and it does work atm with Arc<T>
with the FromRef<T>
impl. I have not changed any of the handlers though. I do think this will do an extra clone on the inner arc, though that is probably negligible.
I think we need to flip the Arc over the type. What I mean by that is that we should have Store, that is cloneable and has a inner Arc. That way we can simply require State<Store>
instead of having to require the Arc in there (as we require right now State<Arc<Store>>
. This will make it a lot easier to work with the store or any other shareable object. (we can also type alias this, though that feels like a bandaid 🤔 )
This will be something that we should do in a future improvement PR.
Put comment about keeping tokio-tungstenite in sync with Axum
Yes indeed. This was done to get this out the door quickly. The lack of tests is also something that I'm not proud of.
Indeed. I think we need to revisit our plans to have a ApiServerError which mirrors the ApiClientError that we have for the fiberplane client.
Yeah I know you like that 😄 I don't like that the api.rs and its child modules are spaced far apart tbh. But I don't like naming everyhting mod.rs either. I'm fine either way, but let's go with this since you like this best |
This is a initial implementation of inspectors, storage, and some other major refactorings.
Creating this PR now otherwise it will grow even bigger and becomes even more difficult to manage. Some of the major shortcoming with this PR won't be resolved here, rather they will be made into tickets which will result in their own PR's.