#[non_exhaustive]pub struct Config {Show 45 fields
pub host: String,
pub base_url: Option<String>,
pub namespaces: Vec<String>,
pub budget: Duration,
pub pool_size: usize,
pub batch_max: usize,
pub test_cells: bool,
pub slice_page: usize,
pub slice_max: usize,
pub catalog_max: usize,
pub explain_depth: usize,
pub max_jobs: usize,
pub manifest_store_max: usize,
pub barrier_timeout: Duration,
pub rate: RateLimits,
pub ttl: Ttls,
pub trust_proxy: bool,
pub cross_mesh: bool,
pub cross_mesh_hosts: Option<Vec<String>>,
pub peers: BTreeMap<String, String>,
pub peer_timeout: Duration,
pub aliases: BTreeMap<String, String>,
pub policy: Policy,
pub catalog: BTreeMap<String, String>,
pub embed_url: Option<String>,
pub api_keys: ApiKeys,
pub publish_domains: PublishDomains,
pub log_dir: Option<PathBuf>,
pub key_names: bool,
pub key_challenge_ttl: Duration,
pub contact: Option<String>,
pub series_first_build_delay: Duration,
pub series_refresh: Duration,
pub catalog_first_build_delay: Duration,
pub catalog_refresh: Duration,
pub index_first_build_delay: Duration,
pub index_secs: Duration,
pub index_class_max: usize,
pub index_max: usize,
pub find_first_build_delay: Duration,
pub value_counts_refresh: Duration,
pub dictionary_max: usize,
pub listed_meshes: Vec<String>,
pub listing_interval: Duration,
pub listing_first_delay: Duration,
/* private fields */
}Expand description
The mesh’s configuration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.host: StringThe DNS name the mesh signs as (computed_by) and serves on: https://<host>/...
(e.g. mesh-test.datumesh.com), unless Config::base_url says otherwise.
base_url: Option<String>Where the mesh is served when not at https://<host>, e.g. http://127.0.0.1:8787
for a mesh on this machine (default: none): the base of every URL in the mesh
document (bindings and the endpoints, crate::Mesh::mesh_document). https://
with any host; http:// only when the mesh’s host is unrooted (its last label is
invalid, SPEC 2.5, e.g. local.invalid) and only with 127.0.0.1, [::1] or
localhost; an optional port; no path, query, fragment or trailing slash
(check_base_url; crate::MeshBuilder::build refuses another with
crate::BuildError::BaseUrl).
An http:// mesh document is for local use only: it is not valid under spec-0.4.3
(9.6 wants https:// URLs on the host), and core 0.3.6’s resolve_mesh refuses it.
spec-0.4.4 will allow exactly this: for an unrooted host, mesh-document URLs and
poll may be http:// on a loopback address only (127.0.0.1, [::1],
localhost); rooted hosts stay https://-only. datumesh-core 0.3.8 will accept it.
The key document and host do not change, nor do the URLs in envelopes and headers
(a pending envelope’s poll, a page’s next, the canonical link), which stay
Config::origin: SPEC 5.5 makes poll an https:// URL, and a client maps
https://<host>/ onto where it reaches the mesh (its peers).
namespaces: Vec<String>The hosts whose names this mesh owns (default: host). A name under any other host
is resolved across meshes.
budget: DurationThe wall-clock budget of a request before it is answered pending (default 1 s).
pool_size: usizeThe blocking pool’s size: the concurrency limit (default 32).
batch_max: usizeThe most cells in one POST /cells (default 1,000).
test_cells: boolWhether each held test is a signed cell (trust primary) <host>/test_case(function_hash, case) (E5:
DATUMESH_TEST_CELLS=1, mesh-test). Off on production: no test cells until named.
slice_page: usizeThe default JSON page of GET /slice (default 1,000; at most 10,000 with limit=).
slice_max: usizeThe most members one slice read serves (default 1,048,576).
catalog_max: usizeThe most subjects the catalogue lists (default 100,000; DATUMESH_CATALOG_MAX).
explain_depth: usizeThe depth of GET /explain by default (default 4; at most 16 with depth=).
max_jobs: usizeThe most jobs held at once, running or done (default 10,000).
manifest_store_max: usizeThe most members an evaluation started by a request may store as a manifest (default 0:
none; DATUMESH_MANIFEST_STORE_MAX). At 0 the engine keeps only member-set rows, and a
manifest is rebuilt on demand (guard patch G4).
barrier_timeout: DurationHow long a request waits for the writers in flight (the store’s barrier) before it fails 503
E_INPUT_UNAVAILABLE (default 5 s; DATUMESH_BARRIER_TIMEOUT_MS; second review B3).
rate: RateLimitsRate limits.
ttl: TtlsCache lifetimes.
trust_proxy: boolTake the client IP from the last X-Forwarded-For entry (behind Caddy) instead of
the peer address (default false).
cross_mesh: boolResolve names under hosts this mesh does not own (default true).
cross_mesh_hosts: Option<Vec<String>>When set, the only other hosts whose names are resolved across meshes; names under
any other host are not served (not_covered). Default: every host.
peers: BTreeMap<String, String>Origins to use instead of https://<host> for some hosts, e.g. mesh-b.example ->
http://127.0.0.1:8081 (tests and private networks only; the default is none).
peer_timeout: DurationThe time limit of one request to another mesh (default 10 s; SPEC 9.3’s bound).
aliases: BTreeMap<String, String>Short names of the call syntax: @alias -> fully qualified name.
policy: PolicyLicence and payment rules.
catalog: BTreeMap<String, String>Descriptions of the functions GET /find searches (name -> description).
embed_url: Option<String>The embedding service’s base URL (DATUMESH_EMBED_URL, e.g. http://embed:8080): vector
find is on when it is set and the store has vectors (default none). Since 0.4.0.
api_keys: ApiKeysAPI keys (Authorization: Bearer dm_...).
publish_domains: PublishDomainsThe hosts that may publish with POST /bundles besides the mesh’s own namespaces
(DATUMESH_PUBLISH_DOMAINS; Build 2 Part 4, D11). Default: none.
log_dir: Option<PathBuf>Where the operator’s log of POST /bundles goes (DATUMESH_LOG_DIR, the file
bundles.log in it); default none, no log.
key_names: boolWhether a key of a publisher can be registered for a namespace of its own: DATUMESH_KEY_NAMES=1
turns GET /x/keys/challenge and POST /x/keys on (QUESTIONS-build2 D39). Default off; any other
value is off too.
key_challenge_ttl: DurationHow long a registration challenge is valid (DATUMESH_KEY_CHALLENGE_TTL_SECS; default 300 s).
contact: Option<String>The address the takeover page names for a source that wants to take over (DATUMESH_CONTACT,
D40). Default none: the page names no address.
series_first_build_delay: DurationHow long the first build of the series overview waits after start (DATUMESH_SERIES_FIRST_BUILD_DELAY_SECS;
default 0). Until that build is done the sitemap and the index answer 503.
series_refresh: DurationHow often the series overview is rebuilt (DATUMESH_SERIES_REFRESH_SECS; default 300 s, at least 1 s).
catalog_first_build_delay: DurationHow long the first build of the catalogue pages waits after start (DATUMESH_CATALOG_FIRST_BUILD_DELAY_SECS;
default 0). Until that build is done the catalogue’s pages and the root of its describe answer 503.
catalog_refresh: DurationHow often the catalogue pages are rebuilt (DATUMESH_CATALOG_REFRESH_SECS; default 300 s, at least 1 s).
index_first_build_delay: DurationHow long the first build of the object index (describe of an object id) waits after start
(DATUMESH_INDEX_FIRST_BUILD_DELAY_SECS; default 0). Until it is built, such a request is 503.
index_secs: DurationHow often the object index is built again (DATUMESH_INDEX_SECS; default 300 s, at least 1 s). A full build
reads each heard-of class’s declared list in pages (CONTRACT-round-0.7-P HP2, HP3); nothing else rebuilds it.
index_class_max: usizeThe most objects one class holds in the object index (DATUMESH_INDEX_CLASS_MAX; default 50,000, at least 1).
A class past it keeps its first objects in cell-id order and is counted in
datumesh_object_index_truncated_total.
index_max: usizeThe most objects the object index holds in all (DATUMESH_INDEX_MAX; default 200,000, at least 1).
find_first_build_delay: DurationHow long the first build of the find summary and the empty query waits after start
(DATUMESH_FIND_FIRST_BUILD_DELAY_SECS; default 0). Until it is built, those requests are 503.
value_counts_refresh: DurationHow often the value counts of the catalogue are refreshed (DATUMESH_VALUE_COUNTS_SECS; default 3600 s,
at least 1 s; and once at start).
dictionary_max: usizeThe most distinct values a string key takes from the cells of a function before it is open
(DATUMESH_DICTIONARY_MAX; default 1000, at least 1; CONTRACT-0.4.9 H7).
listed_meshes: Vec<String>The hosts whose meshes this mesh lists (DATUMESH_LISTED_MESHES, comma-separated; default none; CONTRACT-http-listing
L1, since 0.6.0): their functions as descriptions only, no cells. Refused by Config::check: a host that is one
of Config::namespaces, a host that is not a DNS name, more than 64 hosts. Empty: nothing is fetched.
listing_interval: DurationHow often each listed host is fetched (DATUMESH_LISTING_INTERVAL_SECS; default 21,600 s; at least 1 s).
listing_first_delay: DurationHow long the listing thread waits after start before its first run (DATUMESH_LISTING_FIRST_DELAY_SECS; default 0).
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_base_url(self, url: impl Into<String>) -> Config
pub fn with_base_url(self, url: impl Into<String>) -> Config
The configuration with this base URL (Config::base_url); it is checked when the
mesh is built.
Sourcepub fn from_env() -> Result<Config, ConfigError>
pub fn from_env() -> Result<Config, ConfigError>
The configuration from the environment (DATUMESH_*; the README lists them). The
files named (DATUMESH_API_KEYS_FILE, and the others) are read here; the API keys
file must have mode 0600.
Sourcepub fn from_vars(
get: impl Fn(&str) -> Option<String>,
) -> Result<Config, ConfigError>
pub fn from_vars( get: impl Fn(&str) -> Option<String>, ) -> Result<Config, ConfigError>
The configuration from variables get answers, as Config::from_env reads them.
Sourcepub fn check(&self) -> Result<(), ConfigError>
pub fn check(&self) -> Result<(), ConfigError>
Checks the configuration: names are DNS names and function names, the base URL is
one (check_base_url), numbers in range.
Sourcepub fn origin(&self) -> String
pub fn origin(&self) -> String
https://<host>: where this mesh is served, the base of the URLs in its envelopes.
Sourcepub fn mesh_document_base(&self) -> String
pub fn mesh_document_base(&self) -> String
The base of the URLs in the mesh document: the base URL when set, else
Config::origin.