/// Prepare a mutate request to add the desired of nodes, and returned the IDs
/// of the nodes to be added.
Prepare a mutate request to add the desired of nodes, and returned the IDs
of the nodes to be added.
Prepare a mutate request to add the desired of nodes and returned the IDs of the nodes to be added .
fn prepare_registry(nodes: u64) -> (RegistryAtomicMutateRequest, Vec<NodeId>) {
    // Prepare a transaction to add the nodes to the registry
    let mut mutations = Vec::<RegistryMutation>::default();
    let node_ids: Vec<NodeId> = (0..nodes)
        .map(|_| {
            let temp_dir = temp_dir();
            let (node_pks, node_id) = get_node_keys_or_generate_if_missing(temp_dir.path());
            mutations.push(insert(
                &make_crypto_node_key(node_id, KeyPurpose::DkgDealingEncryption).as_bytes(),
                encode_or_panic(&node_pks.dkg_dealing_encryption_pk.unwrap()),
            ));
            let node_key = make_node_record_key(node_id);
            mutations.push(insert(
                &node_key.as_bytes().to_vec(),
                encode_or_panic(&NodeRecord {
                    xnet: Some(connection_endpoint_from_string(
                        &("128.0.0.1:1234".to_string()),
                    )),
                    http: Some(connection_endpoint_from_string(
                        &("128.0.0.1:1234".to_string()),
                    )),
                    p2p_flow_endpoints: vec!["123,128.0.0.1:10000"]
                        .iter()
                        .map(|x| flow_endpoint_from_string(x))
                        .collect(),
                    node_operator_id: PrincipalId::new_user_test_id(999).into_vec(),
                    ..Default::default()
                }),
            ));
            node_id
        })
        .collect();
    let mutate_request = RegistryAtomicMutateRequest {
        mutations,
        preconditions: vec![],
    };
    (mutate_request, node_ids)
}
fn prepare_registry ( nodes : u64 ) -> ( RegistryAtomicMutateRequest , Vec < NodeId > ) { // Prepare a transaction to add the nodes to the registry let mut mutations = Vec :: < RegistryMutation > :: default ( ) ; let node_ids : Vec < NodeId > = ( 0 .. nodes ) . map ( | _ | { let temp_dir = temp_dir ( ) ; let ( node_pks , node_id ) = get_node_keys_or_generate_if_missing ( temp_dir . path ( ) ) ; mutations . push ( insert ( & make_crypto_node_key ( node_id , KeyPurpose :: DkgDealingEncryption ) . as_bytes ( ) , encode_or_panic ( & node_pks . dkg_dealing_encryption_pk . unwrap ( ) ) , ) ) ; let node_key = make_node_record_key ( node_id ) ; mutations . push ( insert ( & node_key . as_bytes ( ) . to_vec ( ) , encode_or_panic ( & NodeRecord { xnet : Some ( connection_endpoint_from_string ( & ( " " . to_string ( ) ) , ) ) , http : Some ( connection_endpoint_from_string ( & ( " " . to_string ( ) ) , ) ) , p2p_flow_endpoints : vec ! [ " " ] . iter ( ) . map ( | x | flow_endpoint_from_string ( x ) ) . collect ( ) , node_operator_id : PrincipalId :: new_user_test_id ( 999 ) . into_vec ( ) , .. Default :: default ( ) } ) , ) ) ; node_id } ) . collect ( ) ; let mutate_request = RegistryAtomicMutateRequest { mutations , preconditions : vec ! [ ] , } ; ( mutate_request , node_ids ) }
Prepare a mutate request to add the desired of nodes, and returned the IDs
of the nodes to be added.
Prepare a mutate request to add the desired of nodes and returned the IDs of the nodes to be added .
nodes
u64