pub struct CacheConfig {
pub enabled: Option<bool>,
pub root: Option<String>,
pub max_size_gib: Option<u64>,
pub tools: BTreeMap<String, bool>,
pub targets: BTreeMap<String, TargetCacheConfig>,
}Expand description
caches.toml: what an operator changed from the defaults. Everything is
optional; an absent file is every default.
Fields§
§enabled: Option<bool>false turns caches off for every policy on this host.
root: Option<String>The cache root, replacing <runner root>/_cache.
max_size_gib: Option<u64>The cap on the whole root; 0 means no cap.
tools: BTreeMap<String, bool>Tools switched on or off for every policy, by id.
targets: BTreeMap<String, TargetCacheConfig>Per-target settings, keyed by owner/repo or the organization, in
lower case.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn parse(text: &str, path: &Path) -> Result<Self, CacheError>
pub fn parse(text: &str, path: &Path) -> Result<Self, CacheError>
Parses and validates the file’s text.
§Errors
Malformed TOML, an unknown key or tool, an invalid namespace, target or root.
Sourcepub fn load(path: &Path) -> Result<Self, CacheError>
pub fn load(path: &Path) -> Result<Self, CacheError>
Reads path; a file that does not exist is every default.
§Errors
As Self::parse, and CacheError::Io when it cannot be read.
Sourcepub fn save(&self, path: &Path) -> Result<(), CacheError>
pub fn save(&self, path: &Path) -> Result<(), CacheError>
Writes the file atomically, after validating it, removing target sections that no longer say anything.
§Errors
CacheError::Io, or a value that would not load back.
Sourcepub fn target(&self, target: &ScaleTarget) -> Option<&TargetCacheConfig>
pub fn target(&self, target: &ScaleTarget) -> Option<&TargetCacheConfig>
The settings for target, if any.
Sourcepub fn target_mut(&mut self, target: &ScaleTarget) -> &mut TargetCacheConfig
pub fn target_mut(&mut self, target: &ScaleTarget) -> &mut TargetCacheConfig
The settings for target, created empty if absent.
Sourcepub fn host_enabled(&self) -> bool
pub fn host_enabled(&self) -> bool
Whether caches are on for this host at all.