Skip to main content

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

1use crate::subnet_catalog::SubnetKind;
2use serde::{Deserialize, Serialize};
3
4///
5/// NnsNodeListReport
6///
7/// Filtered NNS node inventory report with source metadata.
8///
9
10#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
11#[serde(deny_unknown_fields)]
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 = "nns-host")]
25impl_nns_inventory_report!(
26    NnsNodeListReport,
27    super::super::NNS_NODE_LIST_REPORT_SCHEMA_VERSION,
28    "node",
29    node_count,
30    nodes,
31    |_report: &NnsNodeListReport| None,
32);
33
34///
35/// NnsNodeRow
36///
37/// One node row projected from the NNS registry inventory.
38///
39
40#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
41pub struct NnsNodeRow {
42    pub node_principal: String,
43    pub node_operator_principal: String,
44    pub node_provider_principal: String,
45    pub subnet_principal: String,
46    pub subnet_kind: SubnetKind,
47    pub data_center_id: String,
48}
49
50///
51/// NnsNodeInfoReport
52///
53/// Detailed report for one resolved NNS node.
54///
55
56#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
57pub struct NnsNodeInfoReport {
58    pub schema_version: u32,
59    pub input: String,
60    pub resolved_from: String,
61    pub network: String,
62    pub registry_canister_id: String,
63    pub registry_version: u64,
64    pub fetched_at: String,
65    pub source_endpoint: String,
66    pub fetched_by: String,
67    /// Resolved inventory row.
68    #[serde(flatten)]
69    pub node: NnsNodeRow,
70}