Skip to main content

observe

Function observe 

Source
pub fn observe(
    root: &Path,
    environment: &RepositoryEnvironment,
    policy: Result<&LoadedPolicy, String>,
    rules: Option<RulesTally>,
    probe: Probe,
) -> Observations
Expand description

Read everything a preflight is decided from.

environment is the snapshot already resolved for this call (its version control, layer counts and provider projections are used as they are, never re-read); policy is the policy the caller read, or why it could not; rules is a tally counted in this process, or None to take the one a full resolution cached.

use majordomus_cli::environment::preflight::{derive, observe, Probe, Verdict};
use majordomus_cli::environment::{resolve, EnvironmentQuery, Inputs};
use majordomus_cli::synthetic::SyntheticRepository;

let repo = SyntheticRepository::small().unwrap();
let repository = majordomus_cli::Repository::open(repo.root()).unwrap();
let env = resolve(
    &Inputs { repository: &repository, share: None, index: None, registry: None, policy: None },
    &EnvironmentQuery::fast().sealed(),
);
let p = derive(&observe(repo.root(), &env, Err("not read".into()), None, Probe::sealed()));
// no lease: nothing serves this checkout, and that needs no probe to know
assert_eq!(p.check("integration.server").unwrap().verdict, Verdict::Unavailable);