Skip to main content

ic_query/nns/node_operator/report/model/
report.rs

1#[cfg(feature = "host")]
2use crate::cache_file::JsonCacheReport;
3use serde::{Deserialize, Serialize};
4
5///
6/// NnsNodeOperatorListReport
7///
8/// Complete NNS node operator inventory report with source metadata.
9///
10
11#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12pub struct NnsNodeOperatorListReport {
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_operator_count: usize,
21    pub node_operators: Vec<NnsNodeOperatorRow>,
22}
23
24#[cfg(feature = "host")]
25impl JsonCacheReport for NnsNodeOperatorListReport {
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/// NnsNodeOperatorRow
37///
38/// One node operator row projected from the NNS registry inventory.
39///
40
41#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
42pub struct NnsNodeOperatorRow {
43    pub node_operator_principal: String,
44    pub node_provider_principal: String,
45    pub node_allowance: u64,
46    pub data_center_id: String,
47    pub node_count: Option<u32>,
48}
49
50///
51/// NnsNodeOperatorInfoReport
52///
53/// Detailed report for one resolved NNS node operator.
54///
55
56#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
57pub struct NnsNodeOperatorInfoReport {
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    pub node_operator_principal: String,
68    pub node_provider_principal: String,
69    pub node_allowance: u64,
70    pub data_center_id: String,
71    pub node_count: Option<u32>,
72}
73
74///
75/// NnsNodeOperatorRefreshReport
76///
77/// Outcome of refreshing the cached NNS node operator inventory.
78///
79
80#[cfg(feature = "host")]
81#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
82pub struct NnsNodeOperatorRefreshReport {
83    pub schema_version: u32,
84    pub network: String,
85    pub cache_path: String,
86    pub refresh_lock_path: String,
87    pub output_path: Option<String>,
88    pub registry_canister_id: String,
89    pub registry_version: u64,
90    pub fetched_at: String,
91    pub source_endpoint: String,
92    pub fetched_by: String,
93    pub dry_run: bool,
94    pub wrote_cache: bool,
95    pub replaced_existing_cache: bool,
96    pub node_operator_count: usize,
97}