pub struct Server { /* private fields */ }Expand description
A read-only server for the volumes found under paths.
Implementations§
Source§impl Server
impl Server
Sourcepub fn bind(paths: &[PathBuf], listen: &str) -> Result<Server>
pub fn bind(paths: &[PathBuf], listen: &str) -> Result<Server>
Inspect and verify the volumes under paths, bind listen (for example 127.0.0.1:0).
pub fn bind_with( paths: &[PathBuf], listen: &str, limits: ServerLimits, ) -> Result<Server>
Sourcepub fn bind_tls(
paths: &[PathBuf],
listen: &str,
limits: ServerLimits,
tls: Option<Arc<ServerConfig>>,
) -> Result<Server>
pub fn bind_tls( paths: &[PathBuf], listen: &str, limits: ServerLimits, tls: Option<Arc<ServerConfig>>, ) -> Result<Server>
Like bind_with; with tls every connection is a TLS session using that configuration
(see tls::server_config: the server’s own identity and the client allow list). Every
admitted client may read every set.
Sourcepub fn bind_acl(
paths: &[PathBuf],
listen: &str,
limits: ServerLimits,
tls: Option<Arc<ServerConfig>>,
acl: Acl,
) -> Result<Server>
pub fn bind_acl( paths: &[PathBuf], listen: &str, limits: ServerLimits, tls: Option<Arc<ServerConfig>>, acl: Acl, ) -> Result<Server>
Like bind_tls with per-request authorization: acl decides which admitted client may
read which set (the TLS configuration must admit acl.admitted(); the two are built
together by the CLI). Without tls there is no client identity, so acl must be
Acl::everyone() (anything else would refuse every request).
pub fn local_addr(&self) -> Result<SocketAddr>
pub fn limits(&self) -> ServerLimits
pub fn acl(&self) -> &Acl
pub fn served(&self) -> Vec<ServedSet>
Sourcepub fn run(self, stop: Arc<AtomicBool>) -> Result<()>
pub fn run(self, stop: Arc<AtomicBool>) -> Result<()>
Accept connections until stop is set (checked every 2 ms, so that a sequential client waits
at most that long between one piece and the next); each admitted request runs
on its own thread. Excess connections are answered ERR 503 busy, connections above the
per-address rate ERR 429, and closed; in TLS mode both are closed without a reply, so
no handshake is spent on them. Every admitted connection runs under a time budget
(ServerLimits::timeout, extended per response by min_rate), so a peer that trickles
bytes or stops reading releases its slot when the budget ends.
Auto Trait Implementations§
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Freeze for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more