ic_query/sns/report/model/reports/proposals/
cache.rs1use super::SnsProposalsRefreshAttemptStatus;
8use crate::sns::report::SnsCacheSummarySortKey;
9
10use serde::Serialize;
11
12#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
19pub struct SnsProposalsCacheListReport {
20 pub schema_version: u32,
21 pub network: String,
22 pub cache_root: String,
23 pub cache_count: usize,
24 pub caches: Vec<SnsProposalsCacheSummary>,
25}
26
27#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
34pub struct SnsProposalsCacheStatusReport {
35 pub schema_version: u32,
36 pub network: String,
37 pub cache_root: String,
38 pub input: String,
39 pub found: bool,
40 pub cache: Option<SnsProposalsCacheSummary>,
41 pub expected_cache_path: Option<String>,
42 pub refresh_attempt_path: Option<String>,
43 pub latest_attempt: Option<SnsProposalsRefreshAttemptStatus>,
44}
45
46#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
53pub struct SnsProposalsCacheSummary {
54 pub id: usize,
55 pub name: String,
56 pub root_canister_id: String,
57 pub governance_canister_id: String,
58 pub cache_status: String,
59 pub cache_error: Option<String>,
60 pub complete: bool,
61 pub row_count: usize,
62 pub page_count: u32,
63 pub page_size: u32,
64 pub fetched_at: String,
65 pub source_endpoint: String,
66 pub cache_path: String,
67 pub refresh_attempt_path: String,
68 pub latest_attempt: Option<SnsProposalsRefreshAttemptStatus>,
69}
70
71impl SnsCacheSummarySortKey for SnsProposalsCacheSummary {
72 fn id(&self) -> usize {
73 self.id
74 }
75
76 fn root_canister_id(&self) -> &str {
77 &self.root_canister_id
78 }
79
80 fn cache_path(&self) -> &str {
81 &self.cache_path
82 }
83
84 fn cache_error(&self) -> Option<&str> {
85 self.cache_error.as_deref()
86 }
87}