pub use nexo_tool_meta::admin::plugin_discovery::{
CompatStatus, DiscoveredPlugin, ManifestSummary, PluginCategory, PluginSource, SourceError,
TrustTier,
};
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct CachedCatalogue {
pub fetched_at_ms: u64,
pub items: Vec<DiscoveredPlugin>,
}
impl CachedCatalogue {
pub fn is_stale(&self, now_ms: u64, ttl_ms: u64) -> bool {
now_ms.saturating_sub(self.fetched_at_ms) >= ttl_ms
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn cached_catalogue_is_stale_after_ttl_window() {
let snap = CachedCatalogue {
fetched_at_ms: 1_000,
items: vec![],
};
assert!(snap.is_stale(1_000 + 100, 100));
assert!(!snap.is_stale(1_000 + 99, 100));
assert!(!snap.is_stale(500, 100));
}
}