pub struct Service {
pub home: Home,
pub counters: Counters,
/* private fields */
}Fields§
§home: Home§counters: CountersImplementations§
Source§impl Service
impl Service
pub fn open(home: Home, settings: Settings, clock: Clock) -> Result<Arc<Self>>
pub fn now(&self) -> i64
Sourcepub fn public_key(&self) -> String
pub fn public_key(&self) -> String
The daemon’s current key.
Sourcepub fn handle(&self, req: Request) -> Response
pub fn handle(&self, req: Request) -> Response
A request from nothing known to be in a sandbox.
Sourcepub fn handle_from(
&self,
req: Request,
in_sandbox: &dyn Fn() -> bool,
) -> Response
pub fn handle_from( &self, req: Request, in_sandbox: &dyn Fn() -> bool, ) -> Response
A request; in_sandbox asks the operating system about whoever sent
it, which is only done when it matters.
Sourcepub fn security_event(&self, event: Event)
pub fn security_event(&self, event: Event)
Records a security event.
Sourcepub fn long_line(&self, head: &Head) -> Result<(), (String, String)>
pub fn long_line(&self, head: &Head) -> Result<(), (String, String)>
Whether a line may go on past limits::SHORT_LINE, from what its
first bytes say.
Sourcepub fn sandbox_warnings(&self, sandbox: Sandbox) -> Vec<String>
pub fn sandbox_warnings(&self, sandbox: Sandbox) -> Vec<String>
What to say at the start about sandbox: the repositories whose
verification can not pass without one.
Sourcepub fn proxy_connect(
&self,
cwd: Option<&Path>,
host: &str,
port: u16,
peer: SocketAddr,
) -> ProxyVerdict
pub fn proxy_connect( &self, cwd: Option<&Path>, host: &str, port: u16, peer: SocketAddr, ) -> ProxyVerdict
Records an outbound connection seen by the Lonca proxy and decides
whether to let it through. cwd is the working directory of the
connecting process when it could be determined; the connection is
attributed to the sessions whose workspace contains it, otherwise to
every session routed through the proxy (fail closed).
The proxy’s question: may this connection go through? Every session
it is attributed to has its policy asked (port, host, connections
and bytes), and the attempt is on each one’s record before the
answer, refused or not.
Sourcepub fn proxy_finished(&self, peer: SocketAddr)
pub fn proxy_finished(&self, peer: SocketAddr)
A connection the proxy let through has ended.
Sourcepub fn proxy_carried(&self, peer: SocketAddr, bytes: u64) -> bool
pub fn proxy_carried(&self, peer: SocketAddr, bytes: u64) -> bool
Counts bytes against every session the connection of peer counts
against; false once one of them is past its budget, which cuts it.
Sourcepub fn proxy_unattributed(&self) -> u64
pub fn proxy_unattributed(&self) -> u64
Connections the proxy could not name a process for, since the daemon started.
Sourcepub fn reconcile_all(&self)
pub fn reconcile_all(&self)
Checks refs of every repository (run periodically).
Sourcepub fn process_one(&self, repo: &str) -> Result<Option<SignedOp>>
pub fn process_one(&self, repo: &str) -> Result<Option<SignedOp>>
Integrates the head of one repository’s queue. Merging and verification run without the lock; the result is only logged if the queue head and trunk are unchanged.
Sourcepub fn verification_runs(&self) -> u64
pub fn verification_runs(&self) -> u64
Drains every queue. Returns the number of integration attempts. How often the configured checks of a tree ran.
pub fn process_all(&self) -> usize
Sourcepub fn spawn_worker(self: &Arc<Self>) -> JoinHandle<()>
pub fn spawn_worker(self: &Arc<Self>) -> JoinHandle<()>
Background worker: drains queues when woken, and checks refs.
Trait Implementations§
Source§impl Gate for Service
impl Gate for Service
Source§fn finished(&self, request: &Request<'_>, _outcome: Outcome)
fn finished(&self, request: &Request<'_>, _outcome: Outcome)
Gate::decide ended.Source§fn carried(&self, request: &Request<'_>, bytes: u64) -> bool
fn carried(&self, request: &Request<'_>, bytes: u64) -> bool
bytes relayed for request, either way, before they
are passed on. false cuts the connection: a budget is spent.Source§fn relay(&self, _request: &Request<'_>, tunnel: Tunnel) -> Option<Tunnel>
fn relay(&self, _request: &Request<'_>, tunnel: Tunnel) -> Option<Tunnel>
CONNECT tunnel the gate let through, before a byte
of it is relayed. A gate that serves the tunnel itself (to look
inside TLS for a host it holds the keys of, say) returns None once
it is done; returning the tunnel has the proxy relay its bytes as
they are.Source§fn relay_plain(
&self,
_request: &Request<'_>,
head: String,
tunnel: Tunnel,
) -> Option<(String, Tunnel)>
fn relay_plain( &self, _request: &Request<'_>, head: String, tunnel: Tunnel, ) -> Option<(String, Tunnel)>
http://) request the gate let
through, before a byte of it reaches the host: its head with the
target cut to the path, and the connection to the host, whose
early is what the client sent after the head. A gate that serves
it itself (to read each request on the connection, say) returns
None once it is done; handing them back has the proxy send the
head on and relay the rest as it is.Auto Trait Implementations§
impl !Freeze for Service
impl !RefUnwindSafe for Service
impl !UnwindSafe for Service
impl Forget for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
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
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