ostrya_core/config/groups.rs
1//! The groups `[core]` and `[ex-integrity]` of the repository `config`.
2
3use super::{CollectionIdValue, FreeSpacePercent, LockTimeout, SizeSpec, Tristate};
4use crate::RepoMode;
5
6crate::__config_group! {
7 @builtin [#[doc(hidden)] pub]
8 /// The keys of the `[core]` group.
9 ///
10 /// The module has the name `repo` and not `core`: after a glob import of
11 /// `ostrya::config`, a module `core` hides the `core` crate in the scope
12 /// of the caller.
13 pub group repo = "core" {
14 /// The version of the repository format.
15 ///
16 /// The value is an integer. `RepoConfig::from_keyfile` refuses each
17 /// value other than `1`, and the `ostree` command also refuses to open
18 /// such a repository. The create writes the key, so the key does not
19 /// implement [`Settable`](crate::config::Settable).
20 ///
21 /// A read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
22 /// if the value is not an integer, and
23 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
24 /// if the key is absent.
25 RepoVersion: i64 = "repo_version", required, fixed;
26 /// The storage mode of the repository.
27 ///
28 /// The value is a mode name of [`RepoMode::from_mode_str`]. The create
29 /// writes the key, so the key does not implement
30 /// [`Settable`](crate::config::Settable).
31 ///
32 /// A read gives
33 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
34 /// if the value names no repository mode or if the key is absent, and
35 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
36 /// holds a malformed escape sequence.
37 Mode: RepoMode = "mode", required, fixed;
38 /// The collection id of the repository.
39 ///
40 /// The key has no default. A read gives
41 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
42 /// if the value fails the collection-id rule, and
43 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
44 /// holds a malformed escape sequence.
45 CollectionId: Option<CollectionIdValue> = "collection-id";
46 /// `true` if a write syncs the files that it writes.
47 ///
48 /// The default is `true`. A read gives
49 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
50 /// is not a boolean.
51 Fsync: bool = "fsync", default true, overridable;
52 /// `true` if each content object file is synced when it is staged.
53 ///
54 /// The default is `false`. A metadata object is not synced alone. A
55 /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
56 /// if the value is not a boolean.
57 PerObjectFsync: bool = "per-object-fsync", default false, overridable;
58 /// `true` if the repository lock is on.
59 ///
60 /// The default is `true`. `LockKind` describes the repository lock. A
61 /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
62 /// if the value is not a boolean.
63 Locking: bool = "locking", default true;
64 /// The limit of a lock wait, in seconds.
65 ///
66 /// The default is `300`. The value `-1` means no limit. A read gives
67 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
68 /// if the value is less than `-1`, and
69 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
70 /// is not an integer.
71 LockTimeoutSecs: LockTimeout = "lock-timeout-secs",
72 default LockTimeout::new_const(300), overridable;
73 /// The expiry of a stale entry in `tmp/`, in seconds.
74 ///
75 /// The default is `86400`. A read gives
76 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
77 /// is not an integer.
78 TmpExpirySecs: i64 = "tmp-expiry-secs", default 86400, overridable;
79 /// `true` if the summary announces tombstone commits.
80 ///
81 /// The default is `false`. The summary writes this value as
82 /// `ostree.summary.tombstone-commits`. A read gives
83 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
84 /// is not a boolean.
85 TombstoneCommits: bool = "tombstone-commits", default false, overridable;
86 /// `true` if the repository indexes its static deltas.
87 ///
88 /// The default is `true`. A summary that names deltas writes this value
89 /// as `ostree.summary.indexed-deltas`: the root summary, and in an
90 /// `archive` repository the summary of each auth item
91 /// (`Repo::regenerate_summaries`, "Static deltas"). A read gives
92 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
93 /// is not a boolean.
94 IndexedDeltas: bool = "indexed-deltas", default true, overridable;
95 /// `true` if the repository stores no xattrs.
96 ///
97 /// The default is `false`. No operation of the port reads the key. A
98 /// read gives [`ConfigError::Core`](crate::config::ConfigError::Core)
99 /// if the value is not a boolean.
100 DisableXattrs: bool = "disable-xattrs", default false;
101 /// The finders of a collection pull.
102 ///
103 /// The default is `["config", "mount"]`. For the `ostree` command, the
104 /// key sets the default finders of `ostree find-remotes`, and
105 /// `--finders` wins over it. The port does not carry `find-remotes`,
106 /// and no operation of the port reads the key. A read gives
107 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
108 /// holds a malformed escape sequence.
109 DefaultRepoFinders: Vec<String> = "default-repo-finders",
110 default vec!["config".to_owned(), "mount".to_owned()], overridable;
111 /// The minimum free space that a write must leave, as a size.
112 ///
113 /// The value matches `^([0-9]+)(G|M|T)B$`, and the read takes the text
114 /// as written, with no decode of escape sequences. The key has no
115 /// default. If the key is set, it applies, and [`MinFreeSpacePercent`]
116 /// does not apply. A read gives
117 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
118 /// if the value does not match, or if its magnitude does not fit in a
119 /// `u64`.
120 MinFreeSpaceSize: Option<SizeSpec> = "min-free-space-size", overridable;
121 /// The minimum free space that a write must leave, as a percentage
122 /// of the file system.
123 ///
124 /// The default is `3`. The key applies if [`MinFreeSpaceSize`] is not
125 /// set. A read gives
126 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
127 /// if the value is outside the range `0` to `100`, and
128 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
129 /// is not an integer.
130 MinFreeSpacePercent: FreeSpacePercent = "min-free-space-percent",
131 default FreeSpacePercent::new_const(3), overridable;
132 /// `true` if a ref change regenerates the summary.
133 ///
134 /// The default is `false`. A read gives
135 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
136 /// is not a boolean.
137 AutoUpdateSummary: bool = "auto-update-summary", default false, overridable;
138 /// `true` if an add of a remote writes the new remote into the remotes
139 /// directory.
140 ///
141 /// The default is `false`, so an add writes the remote into `config`.
142 /// The key has an effect only for a handle with a remotes directory.
143 /// The `ostree` command writes into the remotes directory of the system
144 /// repository, and the open detects no system repository. A program for
145 /// an ostree host gives the system repository the fallback value `true`
146 /// with `OpenOptions::fallback`. A read gives
147 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
148 /// is not a boolean.
149 AddRemotesConfigDir: bool = "add-remotes-config-dir", default false, overridable;
150 }
151}
152
153crate::__config_group! {
154 @builtin [#[doc(hidden)] pub]
155 /// The keys of the `[ex-integrity]` group.
156 pub group ex_integrity = "ex-integrity" {
157 /// The composefs setting.
158 ///
159 /// The default is [`Tristate::No`]. The setting sets the default of
160 /// `RepoConfig::fsverity`. The write path does not use the composefs
161 /// deployment behavior that the key also controls. A read gives
162 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
163 /// if the value is not `no`, `maybe`, or `yes`, and
164 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
165 /// holds a malformed escape sequence.
166 Composefs: Tristate = "composefs", default Tristate::No, overridable;
167 /// The fs-verity seal of the loose objects.
168 ///
169 /// - `maybe` or `yes`: each loose object that the object store holds
170 /// as a regular file gets a seal at staging, in every repository
171 /// mode.
172 /// - `yes`: if a seal fails, the write fails with
173 /// `Error::Unsupported`.
174 /// - `maybe`: the write ignores a seal that fails.
175 ///
176 /// With `yes`, the image lookup of
177 /// `Repo::open_composefs_image` also requires a sealed `/root.cfs`
178 /// in the image commit.
179 ///
180 /// The key has no default. `RepoConfig::fsverity` gives the default of
181 /// an absent key from [`Composefs`]. A read gives
182 /// [`ConfigError::InvalidFormat`](crate::config::ConfigError::InvalidFormat)
183 /// if the value is not `no`, `maybe`, or `yes`, and
184 /// [`ConfigError::Core`](crate::config::ConfigError::Core) if the value
185 /// holds a malformed escape sequence.
186 Fsverity: Option<Tristate> = "fsverity", overridable;
187 }
188}