/// Constructs the initial version of the registry containing a subnet with the
/// specified SUBNET_ID, with the node with the specified NODE_ID assigned to
/// it.
Constructs the initial version of the registry containing a subnet with the
specified SUBNET_ID, with the node with the specified NODE_ID assigned to
it.
Constructs the initial version of the registry containing a subnet with the specified SUBNET_ID with the node with the specified NODE_ID assigned to it .
fn make_single_node_registry(
    metrics_registry: &MetricsRegistry,
    subnet_id: SubnetId,
    subnet_type: SubnetType,
    node_id: NodeId,
) -> Arc<RegistryClientImpl> {
    let registry_version = RegistryVersion::from(1);
    let data_provider = Arc::new(ProtoRegistryDataProvider::new());
    let root_subnet_id_proto = SubnetIdProto {
        principal_id: Some(PrincipalIdIdProto {
            raw: subnet_id.get_ref().to_vec(),
        }),
    };
    data_provider
        .add(
            ROOT_SUBNET_ID_KEY,
            registry_version,
            Some(root_subnet_id_proto),
        )
        .unwrap();
    let mut routing_table = RoutingTable::new();
    routing_table_insert_subnet(&mut routing_table, subnet_id).unwrap();
    let pb_routing_table = PbRoutingTable::from(routing_table);
    data_provider
        .add(
            &make_routing_table_record_key(),
            registry_version,
            Some(pb_routing_table),
        )
        .unwrap();
    let pb_whitelist = PbProvisionalWhitelist::from(ProvisionalWhitelist::All);
    data_provider
        .add(
            &make_provisional_whitelist_record_key(),
            registry_version,
            Some(pb_whitelist),
        )
        .unwrap();
    // Set subnetwork list(needed for filling network_topology.nns_subnet_id)
    let mut record = SubnetRecordBuilder::from(&[node_id]).build();
    record.subnet_type = i32::from(subnet_type);
    insert_initial_dkg_transcript(registry_version.get(), subnet_id, &record, &data_provider);
    add_subnet_record(&data_provider, registry_version.get(), subnet_id, record);
    let registry_client = Arc::new(RegistryClientImpl::new(
        data_provider,
        Some(metrics_registry),
    ));
    registry_client.fetch_and_start_polling().unwrap();
    registry_client
}
fn make_single_node_registry ( metrics_registry : & MetricsRegistry , subnet_id : SubnetId , subnet_type : SubnetType , node_id : NodeId , ) -> Arc < RegistryClientImpl > { let registry_version = RegistryVersion :: from ( 1 ) ; let data_provider = Arc :: new ( ProtoRegistryDataProvider :: new ( ) ) ; let root_subnet_id_proto = SubnetIdProto { principal_id : Some ( PrincipalIdIdProto { raw : subnet_id . get_ref ( ) . to_vec ( ) , } ) , } ; data_provider . add ( ROOT_SUBNET_ID_KEY , registry_version , Some ( root_subnet_id_proto ) , ) . unwrap ( ) ; let mut routing_table = RoutingTable :: new ( ) ; routing_table_insert_subnet ( & mut routing_table , subnet_id ) . unwrap ( ) ; let pb_routing_table = PbRoutingTable :: from ( routing_table ) ; data_provider . add ( & make_routing_table_record_key ( ) , registry_version , Some ( pb_routing_table ) , ) . unwrap ( ) ; let pb_whitelist = PbProvisionalWhitelist :: from ( ProvisionalWhitelist :: All ) ; data_provider . add ( & make_provisional_whitelist_record_key ( ) , registry_version , Some ( pb_whitelist ) , ) . unwrap ( ) ; // Set subnetwork list(needed for filling network_topology.nns_subnet_id) let mut record = SubnetRecordBuilder :: from ( & [ node_id ] ) . build ( ) ; record . subnet_type = i32 :: from ( subnet_type ) ; insert_initial_dkg_transcript ( registry_version . get ( ) , subnet_id , & record , & data_provider ) ; add_subnet_record ( & data_provider , registry_version . get ( ) , subnet_id , record ) ; let registry_client = Arc :: new ( RegistryClientImpl :: new ( data_provider , Some ( metrics_registry ) , ) ) ; registry_client . fetch_and_start_polling ( ) . unwrap ( ) ; registry_client }
Constructs the initial version of the registry containing a subnet with the
specified SUBNET_ID, with the node with the specified NODE_ID assigned to
it.
Constructs the initial version of the registry containing a subnet with the specified SUBNET_ID with the node with the specified NODE_ID assigned to it .
metrics_registry
&MetricsRegistry
subnet_id
SubnetId
subnet_type
SubnetType
node_id
NodeId