#[macro_export]
macro_rules! canic_emit_topology_state_endpoints {
() => {
#[cfg(canic_is_root)]
#[$crate::canic_query(requires(caller::is_controller()))]
async fn canic_fleet_state()
-> Result<::canic::dto::state::FleetStateResponse, ::canic::Error> {
Ok($crate::__internal::core::api::state::FleetStateQuery::snapshot())
}
};
}
#[macro_export]
macro_rules! canic_emit_topology_directory_endpoints {
() => {
#[$crate::canic_query(public)]
fn canic_fleet_directory(
page: ::canic::dto::page::PageRequest,
) -> Result<::canic::dto::topology::FleetDirectoryPageResponse, ::canic::Error> {
$crate::__internal::core::api::topology::directory::FleetDirectoryApi::page(page)
.map_err(::canic::Error::from)
}
#[$crate::canic_query(public)]
fn canic_subnet_directory(
page: ::canic::dto::page::PageRequest,
) -> Result<::canic::dto::topology::SubnetDirectoryPageResponse, ::canic::Error> {
$crate::__internal::core::api::topology::directory::SubnetDirectoryApi::page(page)
.map_err(::canic::Error::from)
}
};
}
#[macro_export]
macro_rules! canic_emit_topology_children_endpoints {
() => {
#[$crate::canic_query(public)]
fn canic_canister_children(
page: ::canic::dto::page::PageRequest,
) -> Result<::canic::dto::page::Page<::canic::dto::canister::CanisterInfo>, ::canic::Error>
{
Ok($crate::__internal::core::api::topology::children::CanisterChildrenApi::page(page))
}
};
}
#[macro_export]
macro_rules! canic_emit_topology_placement_endpoints {
() => {
#[cfg(canic_has_scaling)]
#[$crate::canic_query(requires(caller::is_controller()))]
async fn canic_scaling_registry()
-> Result<::canic::dto::placement::scaling::ScalingRegistryResponse, ::canic::Error> {
Ok($crate::__internal::core::api::placement::scaling::ScalingApi::registry())
}
#[cfg(canic_has_sharding)]
#[$crate::canic_query(requires(caller::is_controller()))]
async fn canic_sharding_registry()
-> Result<::canic::dto::placement::sharding::ShardingRegistryResponse, ::canic::Error> {
Ok($crate::__internal::core::api::placement::sharding::ShardingApi::registry())
}
#[cfg(canic_has_sharding)]
#[$crate::canic_query(requires(caller::is_controller()))]
async fn canic_sharding_partition_keys(
pool: String,
shard_pid: ::canic::__internal::cdk::Principal,
) -> Result<::canic::dto::placement::sharding::ShardingPartitionKeysResponse, ::canic::Error> {
Ok($crate::__internal::core::api::placement::sharding::ShardingApi::partition_keys(&pool, shard_pid))
}
};
}
#[macro_export]
macro_rules! canic_bundle_topology_views_endpoints {
() => {
#[cfg(not(canic_disable_bundle_topology_state))]
$crate::canic_emit_topology_state_endpoints!();
#[cfg(not(canic_disable_bundle_topology_directory))]
$crate::canic_emit_topology_directory_endpoints!();
#[cfg(not(canic_disable_bundle_topology_children))]
$crate::canic_emit_topology_children_endpoints!();
#[cfg(not(canic_disable_bundle_topology_placement))]
$crate::canic_emit_topology_placement_endpoints!();
};
}