ic_query/nns/node_provider/report/model/
report.rs1#[cfg(feature = "nns-host")]
2use crate::cache_file::JsonCacheReport;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12#[serde(deny_unknown_fields)]
13pub struct NnsNodeProviderListReport {
14 pub schema_version: u32,
15 pub network: String,
16 pub governance_canister_id: String,
17 pub registry_canister_id: String,
18 pub registry_version: u64,
19 pub fetched_at: String,
20 pub source_endpoint: String,
21 pub fetched_by: String,
22 pub node_provider_count: usize,
23 pub node_providers: Vec<NnsNodeProviderRow>,
24}
25
26#[cfg(feature = "nns-host")]
27impl JsonCacheReport for NnsNodeProviderListReport {
28 fn schema_version(&self) -> u32 {
29 self.schema_version
30 }
31
32 fn network(&self) -> &str {
33 &self.network
34 }
35}
36
37#[cfg(feature = "nns-host")]
38impl_nns_inventory_report!(
39 NnsNodeProviderListReport,
40 super::super::NNS_NODE_PROVIDER_LIST_REPORT_SCHEMA_VERSION,
41 "node_provider",
42 node_provider_count,
43 node_providers,
44 |report: &NnsNodeProviderListReport| Some(report.governance_canister_id.clone()),
45 |report: &NnsNodeProviderListReport| {
46 if report.governance_canister_id != crate::nns::MAINNET_GOVERNANCE_CANISTER_ID {
47 return Err(format!(
48 "governance_canister_id is {}, expected {}",
49 report.governance_canister_id,
50 crate::nns::MAINNET_GOVERNANCE_CANISTER_ID
51 ));
52 }
53 Ok(())
54 },
55);
56
57#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
64pub struct NnsNodeProviderRow {
65 pub node_provider_principal: String,
66 pub name: Option<String>,
67 pub node_count: Option<u32>,
68 pub reward_account_hex: Option<String>,
69}
70
71#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
78pub struct NnsNodeProviderInfoReport {
79 pub schema_version: u32,
80 pub input: String,
81 pub resolved_from: String,
82 pub network: String,
83 pub governance_canister_id: String,
84 pub registry_canister_id: String,
85 pub registry_version: u64,
86 pub fetched_at: String,
87 pub source_endpoint: String,
88 pub fetched_by: String,
89 pub node_provider_principal: String,
90 pub name: Option<String>,
91 pub node_count: Option<u32>,
92 pub reward_account_hex: Option<String>,
93}