docs/generated/contracts.mdgenerated from code
Reference · 3 min read
config
Contracts: config.
Read as
Source: crates/lvcs/src/config.rs.
1/// The `lvcs.toml` sections the daemon reads (discussion:owner/127). Every2/// section is a table whose missing keys keep their defaults, so an absent3/// file or section is the protocol defaults. Each section's type belongs4/// to the lane that reads it: `[limits]` to `M3.grants`5/// (`lvcs_net::grants::Limits`), `[secrets]` to `M3.secrets`6/// (`SecretsConfig`), `[telemetry]` to the daemon, and `[plugins]` to7/// each plugin (an action, a channel, and the runner are the actions8/// plugin's, under `[plugins.actions]`, discussion:owner/532). Other tables (`[deps]`,9/// `[[navigators]]`) are ignored until their lanes add them. `lvcs.toml`10/// is a protected path (`DEFAULT_PROTECTED`), so a change to it is not11/// materialized until approved (discussion:owner/122), and no peer12/// changes the `[limits]` every signer is metered by alone (discussion:owner/146).13/// `[protect]` (`ProtectConfig`, discussion:owner/378) names the files that join14/// the protected paths besides the defaults.15/// Owner: the daemon lanes.16#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]17#[serde(default)]18pub(crate) struct LvcsToml {19 pub(crate) limits: Limits,20 pub(crate) secrets: SecretsConfig,21 pub(crate) telemetry: TelemetryConfig,22 /// `[public]`: what an anonymous reader may read beyond files23 /// (discussion:owner/487).24 pub(crate) public: PublicConfig,25 /// `[protect]`: more protected paths (discussion:owner/378).26 pub(crate) protect: ProtectConfig,27 /// `[plugins]`: each plugin's settings, inline or a path to its own28 /// toml, which is protected like this file (discussion:owner/514).29 pub(crate) plugins: crate::plugin::config::PluginsConfig,30}3132/// `lvcs.toml` `[protect]` (discussion:owner/378): `paths`, gitignore lines, ASCII33/// case-insensitive, of the files that join the protected paths besides34/// `DEFAULT_PROTECTED`: what an action's scripts call or read, which core35/// can't see (discussion:owner/532). Read only at36/// approved heads, like every section, and `lvcs.toml` is protected, so37/// only an approval changes it.38#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]39#[serde(default)]40pub(crate) struct ProtectConfig {41 /// The lines.42 pub(crate) paths: Vec<String>,43}4445/// `lvcs.toml` `[public]` (discussion:owner/487): `machines`, whether an anonymous46/// reader may read `node.load`, off by default. Read at approved heads like47/// every section.48#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]49#[serde(default)]50pub(crate) struct PublicConfig {51 /// Whether anyone may read each node's load.52 pub(crate) machines: bool,53 /// The plugin ledgers an anonymous reader may read, as gitignore-syntax54 /// lines over `.lvcs/x/**` (discussion:owner/567), in place of each55 /// plugin manifest's `public_ledgers`; `None` keeps the manifests'.56 /// Never a private plugin's (the secrets plugin's): a list covering57 /// `.lvcs/x/secrets/` is refused.58 pub(crate) ledgers: Option<Vec<String>>,59}6061/// The secrets plugin's ledgers, which no project makes public62/// (discussion:owner/567): a line set covering this path is refused.63const SECRETS_PROBE: &str = ".lvcs/x/secrets/_";6465/// `lvcs.toml` `[telemetry]` (discussion:owner/71): `subtrees`, the directory66/// prefixes the `subtree` attribute may name (at most `SUBTREE_CAP`);67/// entries past the cap are ignored, so the attribute stays bounded68/// whatever the file says. Owner: `M3.daemon`.69#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]70#[serde(default)]71pub(crate) struct TelemetryConfig {72 /// The directory prefixes the `subtree` attribute may name.73 pub(crate) subtrees: Vec<String>,74}7576/// Why `lvcs.toml` could not be loaded: it could not be read, or it is77/// not TOML of these sections' shapes.78#[derive(Debug)]79pub(crate) enum ConfigError {80 Read(io::Error),81 Parse(String),82}