Skip to main content

ic_query/nns/node_provider/report/model/
report.rs

1#[cfg(feature = "host")]
2use crate::cache_file::JsonCacheReport;
3use serde::{Deserialize, Serialize};
4
5///
6/// NnsNodeProviderListReport
7///
8/// Complete NNS node provider inventory report with source metadata.
9///
10
11#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12pub struct NnsNodeProviderListReport {
13    pub schema_version: u32,
14    pub network: String,
15    pub governance_canister_id: 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_provider_count: usize,
22    pub node_providers: Vec<NnsNodeProviderRow>,
23}
24
25#[cfg(feature = "host")]
26impl JsonCacheReport for NnsNodeProviderListReport {
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/// NnsNodeProviderRow
38///
39/// One node provider row projected from governance and registry data.
40///
41
42#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
43pub struct NnsNodeProviderRow {
44    pub node_provider_principal: String,
45    pub name: Option<String>,
46    pub node_count: Option<u32>,
47    pub reward_account_hex: Option<String>,
48}
49
50///
51/// NnsNodeProviderInfoReport
52///
53/// Detailed report for one resolved NNS node provider.
54///
55
56#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
57pub struct NnsNodeProviderInfoReport {
58    pub schema_version: u32,
59    pub input: String,
60    pub resolved_from: String,
61    pub network: String,
62    pub governance_canister_id: 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_provider_principal: String,
69    pub name: Option<String>,
70    pub node_count: Option<u32>,
71    pub reward_account_hex: Option<String>,
72}
73
74///
75/// NnsNodeProviderRefreshReport
76///
77/// Outcome of refreshing the cached NNS node provider inventory.
78///
79
80#[cfg(feature = "host")]
81#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
82pub struct NnsNodeProviderRefreshReport {
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 governance_canister_id: String,
89    pub registry_canister_id: String,
90    pub registry_version: u64,
91    pub fetched_at: String,
92    pub source_endpoint: String,
93    pub fetched_by: String,
94    pub dry_run: bool,
95    pub wrote_cache: bool,
96    pub replaced_existing_cache: bool,
97    pub node_provider_count: usize,
98}