pub struct RootPreflight<'a> { /* private fields */ }Expand description
The operational check a configured or default runner root must pass.
Built once per decision with the application-data layout it must not collide with, plus every other configured root on this host, and then asked about one candidate at a time.
let paths = AppPaths::discover()?;
let root = default_runner_root(&paths)?;
let checked = RootPreflight::new(&paths).check(&RootOwner::Host, &root)?;
if let Some(leaf) = checked.leaf_to_create() {
// Creation is the caller's explicit step, never the preflight's.
std::fs::create_dir(leaf)?;
}Implementations§
Source§impl<'a> RootPreflight<'a>
impl<'a> RootPreflight<'a>
Sourcepub fn with_probe(
app_paths: &'a AppPaths,
probe: &'a dyn FilesystemProbe,
) -> Self
pub fn with_probe( app_paths: &'a AppPaths, probe: &'a dyn FilesystemProbe, ) -> Self
A preflight that asks probe instead.
Sourcepub fn against(self, owner: RootOwner, root: LocalAbsolutePath) -> Self
pub fn against(self, owner: RootOwner, root: LocalAbsolutePath) -> Self
Registers another configured root the candidate must not overlap.
Pass the host runner root when checking a repository’s, every other repository’s root when checking one repository’s, and every repository’s root when checking the host’s. A root registered under the same owner as the candidate is skipped, so re-validating a setting that is already stored does not report it as overlapping itself.
Sourcepub fn check(
&self,
owner: &RootOwner,
root: &LocalAbsolutePath,
) -> Result<PreflightedRoot, RunnerRootError>
pub fn check( &self, owner: &RootOwner, root: &LocalAbsolutePath, ) -> Result<PreflightedRoot, RunnerRootError>
Decides whether root can hold runner workspaces on this host.
Nothing is created, removed or re-permissioned. On success the caller learns whether the directory already exists and, if not, the single leaf it must create.
§Errors
Any RunnerRootError other than the three that belong to default
resolution.