Skip to main content

ic_query/nns/node/report/model/
report.rs

1#[cfg(feature = "host")]
2use crate::cache_file::JsonCacheReport;
3use crate::subnet_catalog::SubnetKind;
4use serde::{Deserialize, Serialize};
5
6///
7/// NnsNodeListReport
8///
9/// Filtered NNS node inventory report with source metadata.
10///
11
12#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
13pub struct NnsNodeListReport {
14    pub schema_version: u32,
15    pub network: String,
16    pub registry_canister_id: String,
17    pub registry_version: u64,
18    pub fetched_at: String,
19    pub source_endpoint: String,
20    pub fetched_by: String,
21    pub node_count: usize,
22    pub nodes: Vec<NnsNodeRow>,
23}
24
25#[cfg(feature = "host")]
26impl JsonCacheReport for NnsNodeListReport {
27    fn schema_version(&self) -> u32 {
28        self.schema_version
29    }
30
31    fn network(&self) -> &str {
32        &self.network
33    }
34}
35
36///
37/// NnsNodeRow
38///
39/// One node row projected from the NNS registry inventory.
40///
41
42#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
43pub struct NnsNodeRow {
44    pub node_principal: String,
45    pub node_operator_principal: String,
46    pub node_provider_principal: String,
47    pub subnet_principal: String,
48    pub subnet_kind: SubnetKind,
49    pub data_center_id: String,
50}
51
52///
53/// NnsNodeInfoReport
54///
55/// Detailed report for one resolved NNS node.
56///
57
58#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
59pub struct NnsNodeInfoReport {
60    pub schema_version: u32,
61    pub input: String,
62    pub resolved_from: String,
63    pub network: String,
64    pub registry_canister_id: String,
65    pub registry_version: u64,
66    pub fetched_at: String,
67    pub source_endpoint: String,
68    pub fetched_by: String,
69    pub node_principal: String,
70    pub node_operator_principal: String,
71    pub node_provider_principal: String,
72    pub subnet_principal: String,
73    pub subnet_kind: SubnetKind,
74    pub data_center_id: String,
75}
76
77///
78/// NnsNodeRefreshReport
79///
80/// Outcome of refreshing the cached NNS node inventory.
81///
82
83#[cfg(feature = "host")]
84#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
85pub struct NnsNodeRefreshReport {
86    pub schema_version: u32,
87    pub network: String,
88    pub cache_path: String,
89    pub refresh_lock_path: String,
90    pub output_path: Option<String>,
91    pub registry_canister_id: String,
92    pub registry_version: u64,
93    pub fetched_at: String,
94    pub source_endpoint: String,
95    pub fetched_by: String,
96    pub dry_run: bool,
97    pub wrote_cache: bool,
98    pub replaced_existing_cache: bool,
99    pub node_count: usize,
100}