ostrya-core 0.19.1

ostree object model, checksums, on-disk format primitives, and typed config
Documentation
//! The groups `[core]` and `[ex-integrity]` of the repository `config`.

use super::{CollectionIdValue, FreeSpacePercent, LockTimeout, SizeSpec, Tristate};
use crate::RepoMode;

crate::__config_group! {
    @builtin [#[doc(hidden)] pub]
    /// The keys of the `[core]` group.
    ///
    /// The module has the name `repo` and not `core`: after a glob import of
    /// `ostrya::config`, a module `core` hides the `core` crate in the scope
    /// of the caller.
    pub group repo = "core" {
        /// The version of the repository format.
        ///
        /// The value is an integer. `RepoConfig::from_keyfile` refuses each
        /// value other than `1`, and the `ostree` command also refuses to open
        /// such a repository. The create writes the key, so the key does not
        /// implement [`Settable`](crate::config::Settable).
        ///
        /// A read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
        /// if the value is not an integer, and
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the key is absent.
        RepoVersion: i64 = "repo_version", required, fixed;
        /// The storage mode of the repository.
        ///
        /// The value is a mode name of [`RepoMode::from_mode_str`]. The create
        /// writes the key, so the key does not implement
        /// [`Settable`](crate::config::Settable).
        ///
        /// A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value names no repository mode or if the key is absent, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// holds a malformed escape sequence.
        Mode: RepoMode = "mode", required, fixed;
        /// The collection id of the repository.
        ///
        /// The key has no default. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value fails the collection-id rule, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// holds a malformed escape sequence.
        CollectionId: Option<CollectionIdValue> = "collection-id";
        /// `true` if a write syncs the files that it writes.
        ///
        /// The default is `true`. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not a boolean.
        Fsync: bool = "fsync", default true, overridable;
        /// `true` if each content object file is synced when it is staged.
        ///
        /// The default is `false`. A metadata object is not synced alone. A
        /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
        /// if the value is not a boolean.
        PerObjectFsync: bool = "per-object-fsync", default false, overridable;
        /// `true` if the repository lock is on.
        ///
        /// The default is `true`. `LockKind` describes the repository lock. A
        /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
        /// if the value is not a boolean.
        Locking: bool = "locking", default true;
        /// The limit of a lock wait, in seconds.
        ///
        /// The default is `300`. The value `-1` means no limit. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value is less than `-1`, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not an integer.
        LockTimeoutSecs: LockTimeout = "lock-timeout-secs",
            default LockTimeout::new_const(300), overridable;
        /// The expiry of a stale entry in `tmp/`, in seconds.
        ///
        /// The default is `86400`. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not an integer.
        TmpExpirySecs: i64 = "tmp-expiry-secs", default 86400, overridable;
        /// `true` if the summary announces tombstone commits.
        ///
        /// The default is `false`. The summary writes this value as
        /// `ostree.summary.tombstone-commits`. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not a boolean.
        TombstoneCommits: bool = "tombstone-commits", default false, overridable;
        /// `true` if the repository indexes its static deltas.
        ///
        /// The default is `true`. A summary that names deltas writes this value
        /// as `ostree.summary.indexed-deltas`: the root summary, and in an
        /// `archive` repository the summary of each auth item
        /// (`Repo::regenerate_summaries`, "Static deltas"). A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not a boolean.
        IndexedDeltas: bool = "indexed-deltas", default true, overridable;
        /// `true` if the repository stores no xattrs.
        ///
        /// The default is `false`. No operation of the port reads the key. A
        /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
        /// if the value is not a boolean.
        DisableXattrs: bool = "disable-xattrs", default false;
        /// The finders of a collection pull.
        ///
        /// The default is `["config", "mount"]`. For the `ostree` command, the
        /// key sets the default finders of `ostree find-remotes`, and
        /// `--finders` wins over it. The port does not carry `find-remotes`,
        /// and no operation of the port reads the key. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// holds a malformed escape sequence.
        DefaultRepoFinders: Vec<String> = "default-repo-finders",
            default vec!["config".to_owned(), "mount".to_owned()], overridable;
        /// The minimum free space that a write must leave, as a size.
        ///
        /// The value matches `^([0-9]+)(G|M|T)B$`, and the read takes the text
        /// as written, with no decode of escape sequences. The key has no
        /// default. If the key is set, it applies, and [`MinFreeSpacePercent`]
        /// does not apply. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value does not match, or if its magnitude does not fit in a
        /// `u64`.
        MinFreeSpaceSize: Option<SizeSpec> = "min-free-space-size", overridable;
        /// The minimum free space that a write must leave, as a percentage
        /// of the file system.
        ///
        /// The default is `3`. The key applies if [`MinFreeSpaceSize`] is not
        /// set. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value is outside the range `0` to `100`, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not an integer.
        MinFreeSpacePercent: FreeSpacePercent = "min-free-space-percent",
            default FreeSpacePercent::new_const(3), overridable;
        /// `true` if a ref change regenerates the summary.
        ///
        /// The default is `false`. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not a boolean.
        AutoUpdateSummary: bool = "auto-update-summary", default false, overridable;
        /// `true` if an add of a remote writes the new remote into the remotes
        /// directory.
        ///
        /// The default is `false`, so an add writes the remote into `config`.
        /// The key has an effect only for a handle with a remotes directory.
        /// The `ostree` command writes into the remotes directory of the system
        /// repository, and the open detects no system repository. A program for
        /// an ostree host gives the system repository the fallback value `true`
        /// with `OpenOptions::fallback`. A read gives
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// is not a boolean.
        AddRemotesConfigDir: bool = "add-remotes-config-dir", default false, overridable;
    }
}

crate::__config_group! {
    @builtin [#[doc(hidden)] pub]
    /// The keys of the `[ex-integrity]` group.
    pub group ex_integrity = "ex-integrity" {
        /// The composefs setting.
        ///
        /// The default is [`Tristate::No`]. The setting sets the default of
        /// `RepoConfig::fsverity`. The write path does not use the composefs
        /// deployment behavior that the key also controls. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value is not `no`, `maybe`, or `yes`, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// holds a malformed escape sequence.
        Composefs: Tristate = "composefs", default Tristate::No, overridable;
        /// The fs-verity seal of the loose objects.
        ///
        /// - `maybe` or `yes`: each loose object that the object store holds
        ///   as a regular file gets a seal at staging, in every repository
        ///   mode.
        /// - `yes`: if a seal fails, the write fails with
        ///   `Error::Unsupported`.
        /// - `maybe`: the write ignores a seal that fails.
        ///
        /// With `yes`, the image lookup of
        /// `Repo::open_composefs_image` also requires a sealed `/root.cfs`
        /// in the image commit.
        ///
        /// The key has no default. `RepoConfig::fsverity` gives the default of
        /// an absent key from [`Composefs`]. A read gives
        /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
        /// if the value is not `no`, `maybe`, or `yes`, and
        /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
        /// holds a malformed escape sequence.
        Fsverity: Option<Tristate> = "fsverity", overridable;
    }
}