Skip to main content

ic_query/subnet_catalog/
mod.rs

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