pub fn create_data_provider(
    data_provider_config: &DataProviderConfig,
    optional_nns_public_key: Option<ThresholdSigPublicKey>,
) -> Arc<dyn RegistryDataProvider> {
    match data_provider_config {
        DataProviderConfig::RegistryCanisterUrl(url) => {
            let registry_canister = RegistryCanister::new(url.clone());
            match optional_nns_public_key {
                Some(nns_pk) => Arc::new(CertifiedNnsDataProvider::new(registry_canister, nns_pk)),
                None => Arc::new(NnsDataProvider::new(registry_canister)),
            }
        }
        DataProviderConfig::ProtobufFile(path) => {
            Arc::new(ProtoRegistryDataProvider::load_from_file(path))
        }
        DataProviderConfig::Bootstrap { .. } => {
            panic!("The Bootstrap Registry Data Provider is deprecated!")
        }
        DataProviderConfig::LocalStore(path) => Arc::new(LocalStoreImpl::new(path)),
    }
}
/// Instantiate a data provider from a `DataProviderConfig`. In case of
/// `DataProviderConfig::Bootstrap` and
/// `DataProviderConfig::RegistryCanisterUrl`, a corresponding
/// `ThresholdSigPublicKey` can be provided to verify certified updates provided
/// by the registry canister.
Instantiate a data provider from a `DataProviderConfig`.
Instantiate a data provider from a ` DataProviderConfig ` .
pub fn create_data_provider(
    data_provider_config: &DataProviderConfig,
    optional_nns_public_key: Option<ThresholdSigPublicKey>,
) -> Arc<dyn RegistryDataProvider> {
    match data_provider_config {
        DataProviderConfig::RegistryCanisterUrl(url) => {
            let registry_canister = RegistryCanister::new(url.clone());
            match optional_nns_public_key {
                Some(nns_pk) => Arc::new(CertifiedNnsDataProvider::new(registry_canister, nns_pk)),
                None => Arc::new(NnsDataProvider::new(registry_canister)),
            }
        }
        DataProviderConfig::ProtobufFile(path) => {
            Arc::new(ProtoRegistryDataProvider::load_from_file(path))
        }
        DataProviderConfig::Bootstrap { .. } => {
            panic!("The Bootstrap Registry Data Provider is deprecated!")
        }
        DataProviderConfig::LocalStore(path) => Arc::new(LocalStoreImpl::new(path)),
    }
}
pub fn create_data_provider ( data_provider_config : & DataProviderConfig , optional_nns_public_key : Option < ThresholdSigPublicKey > , ) -> Arc < dyn RegistryDataProvider > { match data_provider_config { DataProviderConfig :: RegistryCanisterUrl ( url ) => { let registry_canister = RegistryCanister :: new ( url . clone ( ) ) ; match optional_nns_public_key { Some ( nns_pk ) => Arc :: new ( CertifiedNnsDataProvider :: new ( registry_canister , nns_pk ) ) , None => Arc :: new ( NnsDataProvider :: new ( registry_canister ) ) , } } DataProviderConfig :: ProtobufFile ( path ) => { Arc :: new ( ProtoRegistryDataProvider :: load_from_file ( path ) ) } DataProviderConfig :: Bootstrap { .. } => { panic ! ( " " ) } DataProviderConfig :: LocalStore ( path ) => Arc :: new ( LocalStoreImpl :: new ( path ) ) , } }
Instantiate a data provider from a `DataProviderConfig`.
Instantiate a data provider from a ` DataProviderConfig ` .
data_provider_config
&DataProviderConfig
optional_nns_public_key
Option<ThresholdSigPublicKey>
data_provider_config
&DataProviderConfig
optional_nns_public_key
Option<ThresholdSigPublicKey>