Skip to main content

Module host

Module host 

Source
Expand description

The Host API boundary.

Cove code has no ambient authority. Files, network, clocks, processes, and databases are explicit capabilities with replaceable real, fake, filtered, or denied implementations. The runtime rejects Host API calls that were not granted.

This module holds the boundary itself — HostApi, Grants, and HostRegistry — together with the three small modules that have nothing else to say: Console, Env, and Documents. A host with rules of its own gets a module of its own: crate::clock, crate::files, crate::http, crate::process, and crate::database.

Two things cross this boundary besides plain values. A ResourceHandle goes outwards: the host keeps a connection or a listening socket and Cove holds the name of it, so a later call names the resource the way a method names its receiver. A Reentry goes inwards: a host that was handed a Cove callback — a route’s handler, a repeating timer’s body, the work a timeout bounds — needs a way to run it, and this is the only one there is. Both are ADR 0013’s.

Structs§

Console
console: line-oriented output on two streams.
Documents
documents: a filtered, read-only view over a fixed set of named text documents.
Env
env: read-only access to the environment the host supplies.
Grants
The set of capabilities granted at the execution boundary.
HostRegistry
Holds every host module available to a run, and the grants that gate them.
NoReentry
A Reentry for a caller that has no interpreter to reenter.
ResourceHandle
The identity of one resource a host owns.

Enums§

GrantSource
Where a run’s grants came from, and so what a reader has to change to widen them.

Traits§

HostApi
One host-provided module, such as console or env.
Reentry
How a host runs a Cove callback it was handed.

Functions§

shipped_schema
The schema of every host module the toolchain ships.