oxidecomputer / oxidecomputer/dropshot
Sharing an `ApiDescription` with multiple server instances
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 104
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 22
Description
If one wants to run the same set of endpoints in multiple servers (e.g., in the example added in #543), one awkward corner of dropshot's API is that ApiDescription is not cloneable, so it must be recreated from scratch for each server instance. A couple possibilities, neither of which is trivial to implement:
- We could implement
CloneforApiDescription, but it can't be derived (and many of the types that would also need to implementClonecannot either) because doing so would require the server context to be cloneable, but that isn't actually necessary to clone the description. - We could find a way to sprinkle in some
Arcs to allow sharing anApiDescriptionbetween multiple servers. It's not immediately obvious how to do this due toApiDescription::into_router()consuming theApiDescription.
Contributor guide
No contributing guide indexed for this repository
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 dropshot/src/api_description.rs, especially ApiDescription::into_router() and the surrounding ownership of server context. Trace how an ApiDescription becomes a router and determine what design would let multiple server instances share the endpoint description without recreating it; done means the same description can support multiple servers while preserving the existing context semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100