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