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#[cfg(feature = "host")]
37impl_nns_inventory_report!(
38    NnsNodeListReport,
39    super::super::NNS_NODE_LIST_REPORT_SCHEMA_VERSION,
40    "node",
41    node_count,
42    nodes,
43);
44
45///
46/// NnsNodeRow
47///
48/// One node row projected from the NNS registry inventory.
49///
50
51#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
52pub struct NnsNodeRow {
53    pub node_principal: String,
54    pub node_operator_principal: String,
55    pub node_provider_principal: String,
56    pub subnet_principal: String,
57    pub subnet_kind: SubnetKind,
58    pub data_center_id: String,
59}
60
61///
62/// NnsNodeInfoReport
63///
64/// Detailed report for one resolved NNS node.
65///
66
67#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
68pub struct NnsNodeInfoReport {
69    pub schema_version: u32,
70    pub input: String,
71    pub resolved_from: String,
72    pub network: String,
73    pub registry_canister_id: String,
74    pub registry_version: u64,
75    pub fetched_at: String,
76    pub source_endpoint: String,
77    pub fetched_by: String,
78    pub node_principal: String,
79    pub node_operator_principal: String,
80    pub node_provider_principal: String,
81    pub subnet_principal: String,
82    pub subnet_kind: SubnetKind,
83    pub data_center_id: String,
84}
85
86///
87/// NnsNodeRefreshReport
88///
89/// Outcome of refreshing the cached NNS node inventory.
90///
91
92#[cfg(feature = "host")]
93#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
94pub struct NnsNodeRefreshReport {
95    pub schema_version: u32,
96    pub network: String,
97    pub cache_path: String,
98    pub refresh_lock_path: String,
99    pub output_path: Option<String>,
100    pub registry_canister_id: String,
101    pub registry_version: u64,
102    pub fetched_at: String,
103    pub source_endpoint: String,
104    pub fetched_by: String,
105    pub dry_run: bool,
106    pub wrote_cache: bool,
107    pub replaced_existing_cache: bool,
108    pub node_count: usize,
109}