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