ic-query 0.101.0

Internet Computer query library for CloudEngine, NNS, SNS, ICRC, system canisters, and public network metadata
Documentation
use crate::ic_registry::RegistryFetchError;
use crate::subnet_catalog::SubnetCatalogRegistryValueEncoding;
use ic_host_tools::registry::proto::LargeValueChunkKeys;
#[cfg(feature = "nns-host")]
use ic_platform::Principal;
use serde::Deserialize;

///
/// RegistryValueContent
///
/// Decoded content returned by a registry value lookup.
///

#[derive(Debug)]
pub(super) enum RegistryValueContent {
    Value(Vec<u8>),
    LargeValueChunkKeys(LargeValueChunkKeys),
}

///
/// RegistryVersionedValue
///
/// Completed value plus the individual mutation provenance returned by Registry.
///

#[derive(Debug, Eq, PartialEq)]
pub(super) struct RegistryVersionedValue {
    pub(super) value: Vec<u8>,
    pub(super) version: u64,
    pub(super) timestamp_nanoseconds: u64,
    pub(super) encoding: SubnetCatalogRegistryValueEncoding,
}

///
/// RegistryVersionedValueFailure
///
/// Value-fetch failure retaining response provenance when Registry supplied it.
///

#[derive(Debug)]
pub(super) struct RegistryVersionedValueFailure {
    pub(super) source: RegistryFetchError,
    pub(super) returned_version: Option<u64>,
}

ic_platform::candid_record! {
    ///
    /// RegistryGetChunkRequest
    ///
    /// Candid request for one chunk of a large registry value.
    ///

    #[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
    pub(super) struct RegistryGetChunkRequest {
        603_009_517 => pub(super) content_sha256: Option<Vec<u8>>,
    }
}

ic_platform::candid_record! {
    ///
    /// RegistryChunk
    ///
    /// Candid response containing one validated registry value chunk.
    ///

    #[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
    pub(super) struct RegistryChunk {
        427_265_337 => pub(super) content: Option<Vec<u8>>,
    }
}

#[cfg(feature = "nns-host")]
ic_platform::candid_record! {
    ///
    /// ListNodeProvidersResponse
    ///
    /// Candid governance response containing the current node providers.
    ///

    #[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
    pub(super) struct ListNodeProvidersResponse {
        1_989_342_821 => pub(super) node_providers: Vec<GovernanceNodeProvider>,
    }
}

#[cfg(feature = "nns-host")]
ic_platform::candid_record! {
    ///
    /// GovernanceNodeProvider
    ///
    /// Candid node provider record returned by NNS governance.
    ///

    #[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
    pub(super) struct GovernanceNodeProvider {
        23_515 => pub(super) id: Option<Principal>,
        2_095_839_389 => pub(super) reward_account: Option<GovernanceAccountIdentifier>,
    }
}

#[cfg(feature = "nns-host")]
ic_platform::candid_record! {
    ///
    /// GovernanceAccountIdentifier
    ///
    /// Candid account identifier attached to a governance node provider.
    ///

    #[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
    pub(super) struct GovernanceAccountIdentifier {
        1_158_164_430 => pub(super) hash: Vec<u8>,
    }
}