pub struct Subnet { /* private fields */ }Expand description
Information about a subnet, including its public key, member nodes, and assigned canister ranges.
Range information may be incomplete depending on how the subnet was fetched. The lack of a canister ID
within assigned ranges should not be treated immediately as an authorization failure without fetching
fresh data with Agent::fetch_subnet_by_canister.
Implementations§
Source§impl Subnet
impl Subnet
Sourcepub fn contains_canister(&self, canister_id: &Principal) -> bool
pub fn contains_canister(&self, canister_id: &Principal) -> bool
Checks whether the given canister ID is contained within the subnet’s assigned canister ranges.
Sourcepub fn iter_canister_ranges(&self) -> CanisterRangesIter<'_> ⓘ
pub fn iter_canister_ranges(&self) -> CanisterRangesIter<'_> ⓘ
Returns an iterator over the known canister ID ranges assigned to this subnet.
Sourcepub fn self_reported_key(&self) -> &[u8] ⓘ
pub fn self_reported_key(&self) -> &[u8] ⓘ
Returns the self-reported public key of the subnet.
Note that this key is not authoritative if the subnet is rogue.
Sourcepub fn contains_node(&self, node_id: &Principal) -> bool
pub fn contains_node(&self, node_id: &Principal) -> bool
Checks whether the given node ID is a member of this subnet.
Sourcepub fn get_node_key(&self, node_id: &Principal) -> Option<&[u8]>
pub fn get_node_key(&self, node_id: &Principal) -> Option<&[u8]>
Returns the public key of the given node ID, if it is a member of this subnet.
Sourcepub fn iter_nodes(&self) -> SubnetNodeIter<'_> ⓘ
pub fn iter_nodes(&self) -> SubnetNodeIter<'_> ⓘ
Returns an iterator over the nodes in this subnet.
Sourcepub fn iter_node_keys(&self) -> SubnetKeysIter<'_> ⓘ
pub fn iter_node_keys(&self) -> SubnetKeysIter<'_> ⓘ
Returns an iterator over the node IDs and their corresponding public keys in this subnet.