Skip to main content

Service

Struct Service 

Source
pub struct Service {
    pub home: Home,
    pub counters: Counters,
    /* private fields */
}

Fields§

§home: Home§counters: Counters

Implementations§

Source§

impl Service

Source

pub fn open(home: Home, settings: Settings, clock: Clock) -> Result<Arc<Self>>

Source

pub fn now(&self) -> i64

Source

pub fn public_key(&self) -> String

The daemon’s current key.

Source

pub fn next_key(&self) -> Option<String>

The key of an unfinished rotation.

Source

pub fn handle(&self, req: Request) -> Response

A request from nothing known to be in a sandbox.

Source

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.

Source

pub fn security_event(&self, event: Event)

Records a security event.

Source

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.

Source

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.

Source

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.

Source

pub fn proxy_finished(&self, peer: SocketAddr)

A connection the proxy let through has ended.

Source

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.

Source

pub fn proxy_unattributed(&self) -> u64

Connections the proxy could not name a process for, since the daemon started.

Source

pub fn reconcile_all(&self)

Checks refs of every repository (run periodically).

Source

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.

Source

pub fn verification_runs(&self) -> u64

Drains every queue. Returns the number of integration attempts. How often the configured checks of a tree ran.

Source

pub fn process_all(&self) -> usize

Source

pub fn spawn_worker(self: &Arc<Self>) -> JoinHandle<()>

Background worker: drains queues when woken, and checks refs.

Trait Implementations§

Source§

impl Gate for Service

Source§

fn decide(&self, request: &Request<'_>) -> Verdict

Decides whether request may go through.
Source§

fn finished(&self, request: &Request<'_>, _outcome: Outcome)

Told how every request that reached Gate::decide ended.
Source§

fn carried(&self, request: &Request<'_>, bytes: u64) -> bool

Told of every 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>

Offered every 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)>

Offered every plain (absolute 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.