Skip to main content

Module client

Module client 

Source
Expand description

The store-less client of other meshes (for datumesh-local and for this mesh’s cross-mesh reads): fetch a host’s key document and mesh document, its bindings, a cell’s envelope (by call, URI or pin), slice pages, batches, receipts, descriptors, manifests, blobs and versions, and check each with the core: the envelope against the request (check_answer, check_slice_answer, check_batch), every receipt’s signature against its signer’s key document (fetched from the signer’s own host, never from the mesh that served it), and content-addressed bytes against their hash. Nothing is stored; the import into a store is crate::foreign::Foreign’s, a layer on top.

Blocking. The client is synchronous (ureq, rustls with the Mozilla roots, no redirects, a time limit per request, bodies bounded): this mesh’s engine reads foreign cells from inside an evaluation, which runs on a blocking thread, and datumesh-local’s CLI is synchronous too. An async caller runs it on tokio::task::spawn_blocking, as the mesh’s own handlers do with the engine. Client is cheap to clone and shares its caches.

Caches. Key documents (default 300 s; a key id the cached document lacks refetches it, at most every 10 s) and mesh documents (300 s), in memory. Nothing else is cached here.

Allowlist. With ClientConfig::allowed set, only those hosts are fetched from (anything else is refused with E_INPUT_UNAVAILABLE before any request).

Structs§

Client
The client (see the module documentation).
ClientConfig
The client’s configuration.
ClientError
A failure of the client: the code of the error envelope a mesh would give for it, and why.
Fetched
An answer fetched and checked: its HTTP status, its body as received, and the checked answer.
RemoteBinding
A binding another mesh states (SPEC 9.7).
VersionEntry
One version a mesh lists (SPEC 9.8).
Versions
A page of the versions endpoint (SPEC 9.8).

Functions§

name_host
The host of a function name.
pct
Percent-encodes a value as SPEC 5.1 says (literal characters as themselves).