use serde::Serialize;
use std::path::PathBuf;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SnsCatalogCacheRequest {
pub cache_root: PathBuf,
pub network: String,
}
impl SnsCatalogCacheRequest {
#[must_use]
pub fn new(cache_root: impl Into<PathBuf>, network: impl Into<String>) -> Self {
Self {
cache_root: cache_root.into(),
network: network.into(),
}
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SnsCatalogRefreshRequest {
pub cache: SnsCatalogCacheRequest,
pub source_endpoint: String,
pub now_unix_secs: u64,
pub lock_stale_after_seconds: u64,
}
impl SnsCatalogRefreshRequest {
#[must_use]
pub fn new(
cache_root: impl Into<PathBuf>,
network: impl Into<String>,
source_endpoint: impl Into<String>,
now_unix_secs: u64,
lock_stale_after_seconds: u64,
) -> Self {
Self {
cache: SnsCatalogCacheRequest::new(cache_root, network),
source_endpoint: source_endpoint.into(),
now_unix_secs,
lock_stale_after_seconds,
}
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct SnsCatalogRefreshReport {
pub schema_version: u32,
pub network: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub cache_path: String,
pub refresh_lock_path: String,
pub replaced_existing_cache: bool,
pub sns_count: usize,
pub metadata_error_count: usize,
}