Skip to main content

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

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