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#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
9pub struct NnsNodeProviderListReport {
10    pub schema_version: u32,
11    pub network: String,
12    pub governance_canister_id: String,
13    pub registry_canister_id: String,
14    pub registry_version: u64,
15    pub fetched_at: String,
16    pub source_endpoint: String,
17    pub fetched_by: String,
18    pub node_provider_count: usize,
19    pub node_providers: Vec<NnsNodeProviderRow>,
20}
21
22#[cfg(feature = "host")]
23impl JsonCacheReport for NnsNodeProviderListReport {
24    fn schema_version(&self) -> u32 {
25        self.schema_version
26    }
27
28    fn network(&self) -> &str {
29        &self.network
30    }
31}
32
33///
34/// NnsNodeProviderRow
35///
36#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
37pub struct NnsNodeProviderRow {
38    pub node_provider_principal: String,
39    pub name: Option<String>,
40    pub node_count: Option<u32>,
41    pub reward_account_hex: Option<String>,
42}
43
44///
45/// NnsNodeProviderInfoReport
46///
47#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
48pub struct NnsNodeProviderInfoReport {
49    pub schema_version: u32,
50    pub input: String,
51    pub resolved_from: String,
52    pub network: String,
53    pub governance_canister_id: String,
54    pub registry_canister_id: String,
55    pub registry_version: u64,
56    pub fetched_at: String,
57    pub source_endpoint: String,
58    pub fetched_by: String,
59    pub node_provider_principal: String,
60    pub name: Option<String>,
61    pub node_count: Option<u32>,
62    pub reward_account_hex: Option<String>,
63}
64
65///
66/// NnsNodeProviderRefreshReport
67///
68#[cfg(feature = "host")]
69#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
70pub struct NnsNodeProviderRefreshReport {
71    pub schema_version: u32,
72    pub network: String,
73    pub cache_path: String,
74    pub refresh_lock_path: String,
75    pub output_path: Option<String>,
76    pub governance_canister_id: String,
77    pub registry_canister_id: String,
78    pub registry_version: u64,
79    pub fetched_at: String,
80    pub source_endpoint: String,
81    pub fetched_by: String,
82    pub dry_run: bool,
83    pub wrote_cache: bool,
84    pub replaced_existing_cache: bool,
85    pub node_provider_count: usize,
86}