-
Notifications
You must be signed in to change notification settings - Fork 121
design doc #1
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
Comments
Oh, ideally we could make this work with |
This looks great, btw, including the
For me, the priority looks something like:
|
I think we've done a reasonable job at implementing the general design. I think it's okay to go ahead and close this (: |
Uh oh!
There was an error while loading. Please reload this page.
Surf Architecture
This is a (quick) design document for Surf, an HTTP client with middleware
support in Rust.
Goals
API Example
Rust types are nice in that
send_json
can take a type parameter (User
inthis case) which allows it to try and deserialize the type into that struct, and
if it can't it'll return an error. This allows for super concise JSON APIs!
Another implication of the way this is done is that the struct definitions can
be shared between servers & clients. This means that we can guarantee a server
and corresponding client can work with each other, even if the wire protocol is
something like JSON. And this can further be enhance using something like
session-types.
Architecture
surf
as the top-level framework crate with sane defaults & middlewarehttp-client
to provide the swappable backend layersurf
widely useful. See
rustasync/async-compression.
Middleware
We should take a look at make-fetch-happen and start by building out the features it implements. We should probably define some sort of prioritization here (:
Connection Pooling
A core feature of
surf
should be the ability to perform connection pooling.I'm not sure yet how that works, as I've never used & researched it. But it
seems very important, and we should come up with a design here. I'm thinking
in terms of API it may be something like this:
I somehow suspect that a similar API may be relevant for performing H2 requests
down the line too, as it's yet another form of multiplexing. It's a bit early
right now, but if we can get the API right we can add this functionality at a
later stage without too many surface changes.
Conclusion
This is about it for now. I hope I covered the rough outlines here!
References
The text was updated successfully, but these errors were encountered: