Skip to main content

ic_query/subnet_catalog/
mod.rs

1mod error;
2#[cfg(feature = "host")]
3mod host;
4mod json;
5mod model;
6mod principal;
7#[cfg(feature = "host")]
8mod report;
9mod resolver;
10#[cfg(feature = "host")]
11mod text;
12#[cfg(feature = "host")]
13mod time;
14
15pub use error::CatalogError;
16#[cfg(feature = "host")]
17pub(crate) use host::{
18    LiveNnsRegistryRefreshSource, SubnetCatalogCacheRequest, SubnetCatalogHostError,
19    SubnetCatalogRefreshRequest, SubnetCatalogRefreshSource, load_or_refresh_subnet_catalog,
20    refresh_subnet_catalog,
21};
22#[cfg(all(test, feature = "host"))]
23pub(crate) use host::{
24    load_cached_subnet_catalog, refresh_subnet_catalog_with_source, subnet_catalog_path,
25    subnet_catalog_refresh_lock_path,
26};
27pub use json::{catalog_to_pretty_json, parse_catalog_json};
28pub use model::{
29    ClassificationSource, GeographicScope, RoutingRange, SubnetCatalog, SubnetInfo, SubnetKind,
30    SubnetSpecialization,
31};
32pub use principal::canonical_principal_text;
33pub(crate) use principal::{parse_principal, principal_bytes};
34#[cfg(feature = "host")]
35pub(crate) use report::{
36    CatalogStaleStatus, SubnetCatalogFilters, SubnetCatalogInfoReport, SubnetCatalogInfoRequest,
37    SubnetCatalogListReport, SubnetCatalogListRequest, SubnetCatalogRefreshReport,
38    build_subnet_catalog_info_report, build_subnet_catalog_list_report,
39};
40#[cfg(all(test, feature = "host"))]
41pub(crate) use report::{SubnetCatalogSubnetRow, build_subnet_catalog_list_report_with_source};
42pub use resolver::{ResolveAs, ResolvedSubnet, ResolvedSubnetSubject};
43#[cfg(all(test, feature = "host"))]
44pub(crate) use text::compact_principal;
45#[cfg(feature = "host")]
46pub(crate) use text::{
47    subnet_catalog_info_report_text, subnet_catalog_list_report_text,
48    subnet_catalog_list_report_verbose_text, subnet_catalog_refresh_report_text,
49};
50#[cfg(all(test, feature = "host"))]
51pub(crate) use time::parse_stale_after_duration;
52#[cfg(feature = "host")]
53pub(crate) use time::{catalog_stale_status, format_utc_timestamp_secs};
54
55pub const CATALOG_SCHEMA_VERSION: u32 = 1;
56pub const MAINNET_NETWORK: &str = "ic";
57pub const MAINNET_REGISTRY_CANISTER_ID: &str = "rwlgt-iiaaa-aaaaa-aaaaa-cai";
58#[cfg(feature = "host")]
59pub(crate) const DEFAULT_STALE_AFTER_SECONDS: u64 = 7 * 24 * 60 * 60;
60#[cfg(feature = "host")]
61pub(crate) const DEFAULT_REFRESH_LOCK_STALE_SECONDS: u64 = 30 * 60;
62#[cfg(feature = "host")]
63pub(crate) const DEFAULT_SUBNET_CATALOG_SOURCE_ENDPOINT: &str = "https://icp-api.io";
64#[cfg(feature = "host")]
65pub(crate) const SUBNET_CATALOG_LIST_REPORT_SCHEMA_VERSION: u32 = 1;
66#[cfg(feature = "host")]
67pub(crate) const SUBNET_CATALOG_INFO_REPORT_SCHEMA_VERSION: u32 = 1;
68#[cfg(feature = "host")]
69pub(crate) const SUBNET_CATALOG_REFRESH_REPORT_SCHEMA_VERSION: u32 = 1;
70
71#[cfg(test)]
72mod core_tests;
73#[cfg(all(test, feature = "host"))]
74mod tests;