Skip to main content

Mesh

Struct Mesh 

Source
pub struct Mesh { /* private fields */ }
Expand description

A Datumesh mesh: the engine behind the endpoints. Cheap to clone (shared).

Implementations§

Source§

impl Mesh

Source

pub fn router(&self) -> Router

The router of every endpoint. Serve it with into_make_service_with_connect_info::<SocketAddr>() (the client IP comes from it).

Source

pub async fn serve( &self, listener: TcpListener, shutdown: impl Future<Output = ()> + Send + 'static, ) -> Result<()>

Serves the router on listener until shutdown resolves.

Source§

impl Mesh

Source

pub fn builder( config: Config, store: Arc<dyn Store + Send + Sync>, ) -> MeshBuilder

A builder for a mesh on store with config.

Source

pub fn config(&self) -> &Config

The configuration.

Source

pub fn engine(&self) -> &Arc<Engine> ⓘ

The engine.

Source

pub fn clear_memo(&self)

Forgets every memoised answer (the engine’s memo and the mesh’s), for a process that wrote versions without telling the mesh.

Source

pub fn foreign(&self) -> &Foreign

The cross-mesh resolver.

Source

pub fn store(&self) -> &Arc<dyn Store + Send + Sync> ⓘ

The store.

Source

pub fn keys(&self) -> &KeyCache

The key documents the mesh holds for other hosts (fetched, or inserted here): what POST /verify verifies with, besides the store’s namespace records.

Source

pub fn stored_version_added(&self, cell_id: &str)

Tells the engine that a stored version was added for cell_id outside the mesh.

Source

pub fn cell(&self, rest: &str, principal: Option<&Principal>) -> Reply

The envelope for rest (a call or a cell URI’s rest, query included, as received at /cell/), for principal. Blocking, and without a budget: what a /cell request gets when it finishes within its budget, or its job’s result.

Source

pub fn cells( &self, rests: &[String], principal: Option<&Principal>, ) -> Vec<Reply>

The envelopes of a batch, in order (blocking, no budget).

Source

pub fn resolve(&self, rest: &str, slice: bool) -> Result<Arc<Target>, Rejection>

Resolves a request to its cell, as /cell does (or to its slice, with slice).

Source

pub fn describe(&self, id: &str) -> Reply

The describe answer (SPEC 16.8, 9.6) for id: a class name, an object’s key encoding, an object id, a cell id or a short id (12 hex digits). A class or an object: the body is a describe-class or describe-object document, 200; an id the mesh does not know, 404; a short id naming more than one object or cell the mesh knows, 400 with E_SHORT_ID_AMBIGUOUS. A class hash is not an id (9.6). Blocking. Since 0.2.2.

Source

pub fn verify( &self, receipt: &[u8], signed_only: bool, blob: Option<&[u8]>, ) -> Verified

Verifies a receipt (SPEC 10.1) with the mesh’s keys; at level recomputed with the engine as the resolver unless signed_only; blob is content for step 7.7.

Source

pub fn verify_offered( &self, receipt: &[u8], recompute: Option<&Value>, blob: Option<&[u8]>, ) -> Verified

Verifies a receipt with the mesh’s keys and what the caller offers for step 7: a recompute object as SPEC 11 describes it (descriptor, inputs, manifests, lineage, value), the core’s MapResolver over it. Without one, steps 1-6 only.

Source

pub fn mesh_document(&self) -> Vec<u8> ⓘ

The mesh document (SPEC 9.6) this mesh serves: its URLs on the base URL when one is set (Config::base_url), else on https://<host>.

Source

pub fn key_document(&self) -> Option<Vec<u8>>

The key document this mesh serves: the store’s namespace record for its host.

Source

pub fn metrics(&self) -> String

The Prometheus text of /metrics.

Source

pub fn requests_of(&self, route: &str) -> u64

The number of requests counted for a route template (e.g. /cell/{cell}).

Source

pub fn host_of(name: &str) -> &str

The host of a function name (its first segment).

Source

pub fn uptime(&self) -> Duration

How long the mesh has run.

Trait Implementations§

Source§

impl Clone for Mesh

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mesh

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Mesh

§

impl !UnwindSafe for Mesh

§

impl Forget for Mesh

§

impl Freeze for Mesh

§

impl Move for Mesh

§

impl Send for Mesh

§

impl Sync for Mesh

§

impl Unpin for Mesh

§

impl UnsafeUnpin for Mesh

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more