use serde::Serialize;
use std::path::PathBuf;
pub const CACHE_STATUS_REPORT_SCHEMA_VERSION: u32 = 1;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CacheStatusRequest {
pub cache_root: PathBuf,
pub now_unix_secs: u64,
}
impl CacheStatusRequest {
#[must_use]
pub fn new(cache_root: impl Into<PathBuf>, now_unix_secs: u64) -> Self {
Self {
cache_root: cache_root.into(),
now_unix_secs,
}
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct CacheStatusReport {
pub schema_version: u32,
pub cache_root: String,
pub inspected_at: String,
pub cache_root_found: bool,
pub scan_limit: usize,
pub truncated: bool,
pub cache_count: usize,
pub fresh_count: usize,
pub stale_count: usize,
pub unmanaged_count: usize,
pub invalid_count: usize,
pub total_size_bytes: u64,
pub caches: Vec<CacheStatusRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct CacheStatusRow {
pub component: String,
pub cache_path: String,
pub relative_path: String,
pub status: String,
pub schema_version: Option<u32>,
pub network: Option<String>,
pub fetched_at: Option<String>,
pub age_seconds: Option<u64>,
pub stale_after_seconds: Option<u64>,
pub size_bytes: u64,
pub error: Option<String>,
}