pub struct DependencyCaches { /* private fields */ }Expand description
Where the cache settings and the default root come from.
Implementations§
Source§impl DependencyCaches
impl DependencyCaches
Sourcepub fn new(
config_file: PathBuf,
runner_root: RunnerRootSource,
fallback: Option<PathBuf>,
) -> Self
pub fn new( config_file: PathBuf, runner_root: RunnerRootSource, fallback: Option<PathBuf>, ) -> Self
config_file is caches.toml; fallback is
dependency_cache::platform_fallback_root.
Sourcepub fn without_git(self) -> Self
pub fn without_git(self) -> Self
Withholds the Git checkout cache.
Preparing and capturing it runs git in this process over a checkout
the job wrote. When the job runs as another, unprivileged account, that
would let it hand this process repository configuration to act on –
core.fsmonitor names a command – so the cache is not offered at all.
Sourcepub fn config(&self) -> Result<CacheConfig, FailureReason>
pub fn config(&self) -> Result<CacheConfig, FailureReason>
The settings, read now.
§Errors
A file that cannot be read or parsed, as a launch failure that names the file and the command that fixes it.
Sourcepub fn root(&self, config: &CacheConfig) -> Result<ResolvedRoot, String>
pub fn root(&self, config: &CacheConfig) -> Result<ResolvedRoot, String>
Sourcepub fn for_launch(
&self,
target: &ScaleTarget,
runtime: &Path,
host_env: &RunnerEnv,
) -> Vec<(&'static str, OsString)>
pub fn for_launch( &self, target: &ScaleTarget, runtime: &Path, host_env: &RunnerEnv, ) -> Vec<(&'static str, OsString)>
The variables a native runner of target whose attempt is at runtime
starts with, after leasing its slot and creating its directories.
A tool any of whose variables host_env or the service’s own
environment already sets is left out entirely, so an operator’s setting
is never mixed with this one. Never fails: prepare already refused a
broken file, and anything wrong now costs the job its caches, not its
runner.
Sourcepub fn capture_git(&self, runtime: &Path)
pub fn capture_git(&self, runtime: &Path)
Refresh the object snapshot after native runner termination. Cache failures never prevent ordinary workspace cleanup, and switches changed while a job ran are respected before any publication.
Sourcepub fn prune_scheduled(&self)
pub fn prune_scheduled(&self)
The service’s scheduled pass: measures the cache root and prunes it to the configured cap. Does nothing when caches are off, no root resolves or the root does not exist yet.
Sourcepub fn answer_prune_request(&self, state_dir: &Path, request: String)
pub fn answer_prune_request(&self, state_dir: &Path, request: String)
Carries out an operator’s host cache prune that their account could
not, and answers it in dependency_cache::PRUNE_RESULT_FILE under
the identifier request carried.
A request is carried out whether or not caches are on, exactly as the command does when its account can write the root itself; only the scheduled pass respects the switch.