Create server util to allow pulling requests
Open
Nobody has claimed this yet.
A-server
C-feature
E-medium
K-hyper-util
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
The current server API is callback-based, where Service is called whenever a request is received. Some applications need to invert it such that they take a request only when they are ready. This proposes creating a utility in hyper-util that would allow usage similar to this:
// naming is hard
let (svc, rx) = hyper_util::server::puller();
let conn = Http::new().serve_connection(socket, svc);
tokio::spawn(conn);
// pull off requests
while let Some((req, tx)) = rx.next().await? {
println!("{:?}", req);
tx.respond(Response::new(Empty::new());
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the server Service API and the hyper-util entry points around Http::new().serve_connection. Define the puller’s request and response-channel behavior, including readiness and shutdown, then verify that it supports the usage shown with tokio::spawn and an async request loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100