mod artifact_identity;
mod build_identity;
mod codec;
mod inspection;
mod persistence;
mod schema;
mod validation;
pub(super) use codec::autoroute_cache_file_presence;
pub(crate) use inspection::{inspect_autoroute_cache, AutorouteReadiness};
pub(super) use persistence::{
load_autoroute_cache, save_autoroute_cache, AutorouteCacheSaveOutcome,
};
pub(crate) use persistence::StagedAutorouteCache;
pub(super) fn current_engine_identity() -> String {
schema::AutorouteBuildFeatures::current().describe()
}
pub(super) fn current_executable_identity(
) -> Result<&'static str, Box<dyn std::error::Error + Send + Sync>> {
artifact_identity::current_executable_sha256()
}
#[cfg(test)]
pub(super) use codec::AUTOROUTE_CACHE_FILE_BYTES;
#[cfg(test)]
pub(super) use schema::{AutorouteBuildFeatures, AutorouteCache};
#[cfg(test)]
use keyhog_scanner::hw_probe::ScanBackend;
#[cfg(test)]
use std::collections::HashMap;
#[cfg(test)]
use super::evidence::AutorouteDecision;
#[cfg(test)]
use super::workload::WorkloadKey;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg(test)]
pub(super) enum BucketResolution {
Exact(ScanBackend),
Unresolved,
}
#[cfg(test)]
pub(super) fn resolve_bucket(
decisions: &HashMap<WorkloadKey, AutorouteDecision>,
key: &WorkloadKey,
) -> BucketResolution {
if let Some(backend) = decisions.get(key).and_then(AutorouteDecision::backend) {
return BucketResolution::Exact(backend);
}
BucketResolution::Unresolved
}