use serde::Serialize;
use std::path::PathBuf;
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[serde(tag = "phase", rename_all = "snake_case")]
pub enum CatalogAcquisitionStage {
CacheLookup,
Collecting {
endpoint: String,
},
Collected {
endpoint: String,
registry_version: u64,
query_calls: u64,
},
Complete {
cache_disposition: String,
},
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct CatalogAcquisitionProgress {
pub stage: CatalogAcquisitionStage,
pub completed_endpoints: usize,
pub active_endpoints: Vec<String>,
pub registry: Vec<RegistryCollectionProgress>,
pub elapsed_seconds: u64,
pub deadline_seconds: u64,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct SubnetCatalogObservation {
pub cache_path: PathBuf,
pub cache_disposition: String,
pub fetched_at: String,
pub observed_at_unix_secs: u64,
pub age_seconds: Option<u64>,
pub max_age_seconds: u64,
pub registry_version: u64,
pub catalog_digest: String,
pub assurance: String,
pub source_endpoints: Vec<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct RegistryCollectionProgress {
pub endpoint: String,
pub query_calls: u64,
pub stage: RegistryCollectionStage,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[serde(tag = "phase", rename_all = "snake_case")]
pub enum RegistryCollectionStage {
Started,
Pinned {
registry_version: u64,
},
History {
registry_version: u64,
through_version: u64,
reused: bool,
},
Record {
registry_version: u64,
key: String,
completed: bool,
},
Retry {
method: String,
next_attempt: u8,
delay_millis: u64,
},
}