Expand description
The HTTP server of ostrya, for the pull and the push of one repository.
A Server serves one repository to the pull of the ostree command and
of ostrya. The pull reads it as an archive repository, whatever its mode
(see ostrya::ArchiveView). With a receive policy, the server also runs
the receive endpoint of a push. A host with its own HTTP router mounts
that endpoint as a ReceiveEndpoint and authenticates the requests
itself. The server also answers GET /_ostrya/refs/v1 with the bytes of
ostrya::Repo::build_ref_listing for the ref patterns of its query. The
crate builds on Linux alone.
§Entry points
servebinds the listeners of aServeOptionsand runs the server.bindbinds the listeners and returns aServerto run withServer::run.ServeOptionsholds the addresses, the TLS files, and the options of a push.ReceiveEndpoint::newcreates the receive endpoint for the router of a host.ReceiveEndpoint::handleanswers one request of the endpoint.ReceiveAuthis the authentication of the endpoint by its host.Erroris the error of each fallible operation of the crate.
§Features
smol(default): thesmolbackend ofostrya-rt.tokio: thetokiobackend ofostrya-rt, for a host on tokio.
§Examples
use ostrya::Repo;
use ostrya_server::{ServeOptions, bind};
let repo = Repo::open("/srv/repo".as_ref()).await?;
let mut opts = ServeOptions::default();
opts.listen = vec!["0.0.0.0:8080".parse()?];
let server = bind(repo, opts).await?;
println!("listening on {:?}", server.local_addrs());
server.run().await?;Structs§
- Endpoint
Options - The options of
ReceiveEndpoint::new. - Receive
Body - The response body of
ReceiveEndpoint::handle. - Receive
Endpoint - The receive endpoint of a push, which a host mounts in its own router.
- Refusal
- A refusal of
ReceiveAuth::authenticateorReceiveAuth::open. - Serve
Options - The options of
bind. - Server
- A server with its listeners bound, ready to
run. - Server
Tls - The PEM bytes of the server TLS files.
- Session
Setup - The receive policy and the hooks that
ReceiveAuth::opengives to a session.
Enums§
- Error
- The error of
bindand ofReceiveEndpoint::new. - Request
Kind - The route of a request of the receive endpoint.
Traits§
- Receive
Auth - The authentication of the requests of the receive endpoint.
Functions§
- bind
- Binds the listeners of
optsand returns a server overrepo. - serve
- Binds the listeners of
optsand runs the server until the future drops.
Type Aliases§
- Result
- The result type of the crate.