mod cache;
pub(in crate::nns) use cache::{load_nns_leaf_json_cache, write_nns_leaf_json_refresh_cache};
use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Eq, PartialEq)]
pub(in crate::nns) struct NnsLeafCachePaths {
pub(in crate::nns) cache_path: PathBuf,
pub(in crate::nns) lock_path: PathBuf,
}
impl NnsLeafCachePaths {
#[must_use]
pub(in crate::nns) fn for_component(
cache_root: &Path,
component_dir: &str,
network: &str,
cache_file: &str,
) -> Self {
let cache_dir = cache_root.join("nns").join(network).join(component_dir);
Self {
cache_path: cache_dir.join(cache_file),
lock_path: cache_dir.join("refresh.lock"),
}
}
}
#[cfg(all(test, feature = "nns-host"))]
mod tests;