ic-query 0.6.4

Internet Computer query library for NNS, SNS, ICRC, and related public network metadata
Documentation
//! Module: cache_file::json::model
//!
//! Responsibility: shared JSON cache report contracts.
//! Does not own: filesystem IO, refresh policy, or command-specific report fields.
//! Boundary: defines minimal metadata needed for schema and network validation.

use std::path::PathBuf;

///
/// CachedJsonReport
///
/// Loaded JSON cache report paired with the file path it came from.
///

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CachedJsonReport<T> {
    pub path: PathBuf,
    pub report: T,
}

///
/// JsonCacheReport
///
/// Minimal metadata every JSON cache report exposes for validation.
///

pub trait JsonCacheReport {
    fn schema_version(&self) -> u32;
    fn network(&self) -> &str;
}

///
/// LoadJsonCacheRequest
///
/// Inputs needed to load and validate one JSON cache report.
///

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct LoadJsonCacheRequest<'a> {
    pub path: PathBuf,
    pub network: &'a str,
    pub expected_schema_version: u32,
}