use crate::{
snapshot_cache::SnapshotRefreshAttempt, sns::report::cache_attempt::SnsRefreshAttemptMetadata,
};
use serde::Serialize;
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct SnsRefreshAttemptStatus {
pub id: usize,
pub network: String,
pub source_endpoint: String,
pub root_canister_id: String,
pub governance_canister_id: String,
pub status: String,
pub started_at: String,
pub updated_at: String,
pub page_size: u32,
pub pages_fetched: u32,
pub rows_fetched: usize,
pub last_cursor: Option<String>,
pub last_error: Option<String>,
}
impl From<SnapshotRefreshAttempt<SnsRefreshAttemptMetadata>> for SnsRefreshAttemptStatus {
fn from(attempt: SnapshotRefreshAttempt<SnsRefreshAttemptMetadata>) -> Self {
Self {
id: attempt.metadata.id,
network: attempt.network,
source_endpoint: attempt.source_endpoint,
root_canister_id: attempt.metadata.root_canister_id,
governance_canister_id: attempt.metadata.governance_canister_id,
status: attempt.status,
started_at: attempt.started_at,
updated_at: attempt.updated_at,
page_size: attempt.page_size,
pages_fetched: attempt.pages_fetched,
rows_fetched: attempt.rows_fetched,
last_cursor: attempt.last_cursor,
last_error: attempt.last_error,
}
}
}