/// Returns a mutation that sets the initial state of the registry to be
/// compliant with its invariants.
Returns a mutation that sets the initial state of the registry to be
compliant with its invariants.
Returns a mutation that sets the initial state of the registry to be compliant with its invariants .
pub fn invariant_compliant_mutation() -> Vec<RegistryMutation> {
    let node_operator_pid = user_test_id(TEST_ID);
    let node_pid = node_test_id(TEST_ID);
    let subnet_pid = subnet_test_id(TEST_ID);
    let connection_endpoint = ConnectionEndpoint {
        ip_addr: "128.0.0.1".to_string(),
        port: 12345,
        protocol: Protocol::Http1 as i32,
    };
    let node = NodeRecord {
        node_operator_id: node_operator_pid.get().to_vec(),
        xnet: Some(connection_endpoint.clone()),
        http: Some(connection_endpoint),
        ..Default::default()
    };
    const VERSION_REPLICA_ID: &str = "version_42";
    const MOCK_HASH: &str = "d1bc8d3ba4afc7e109612cb73acbdddac052c93025aa1f82942edabb7deb82a1";
    let replica_version = ReplicaVersionRecord {
        release_package_url: "http://release_package.tar.gz".into(),
        release_package_sha256_hex: MOCK_HASH.into(),
    };
    let blessed_replica_version = BlessedReplicaVersions {
        blessed_version_ids: vec![VERSION_REPLICA_ID.to_string()],
    };
    let subnet_list = SubnetListRecord {
        subnets: vec![subnet_pid.get().to_vec()],
    };
    let system_subnet = SubnetRecord {
        membership: vec![node_pid.get().to_vec()],
        subnet_type: i32::from(SubnetType::System),
        replica_version_id: VERSION_REPLICA_ID.to_string(),
        unit_delay_millis: 600,
        gossip_config: Some(build_default_gossip_config()),
        ..Default::default()
    };
    vec![
        insert(
            make_subnet_list_record_key().as_bytes().to_vec(),
            encode_or_panic(&subnet_list),
        ),
        insert(
            make_subnet_record_key(subnet_pid).as_bytes().to_vec(),
            encode_or_panic(&system_subnet),
        ),
        insert(
            make_routing_table_record_key().as_bytes().to_vec(),
            encode_or_panic(&RoutingTablePB::default()),
        ),
        insert(
            make_node_record_key(node_pid).as_bytes().to_vec(),
            encode_or_panic(&node),
        ),
        insert(
            make_replica_version_key(VERSION_REPLICA_ID)
                .as_bytes()
                .to_vec(),
            encode_or_panic(&replica_version),
        ),
        insert(
            make_blessed_replica_version_key().as_bytes().to_vec(),
            encode_or_panic(&blessed_replica_version),
        ),
    ]
}
pub fn invariant_compliant_mutation ( ) -> Vec < RegistryMutation > { let node_operator_pid = user_test_id ( TEST_ID ) ; let node_pid = node_test_id ( TEST_ID ) ; let subnet_pid = subnet_test_id ( TEST_ID ) ; let connection_endpoint = ConnectionEndpoint { ip_addr : " " . to_string ( ) , port : 12345 , protocol : Protocol :: Http1 as i32 , } ; let node = NodeRecord { node_operator_id : node_operator_pid . get ( ) . to_vec ( ) , xnet : Some ( connection_endpoint . clone ( ) ) , http : Some ( connection_endpoint ) , .. Default :: default ( ) } ; const VERSION_REPLICA_ID : & str = " " ; const MOCK_HASH : & str = " " ; let replica_version = ReplicaVersionRecord { release_package_url : " " . into ( ) , release_package_sha256_hex : MOCK_HASH . into ( ) , } ; let blessed_replica_version = BlessedReplicaVersions { blessed_version_ids : vec ! [ VERSION_REPLICA_ID to_string ( ) ] , } ; let subnet_list = SubnetListRecord { subnets : vec ! [ subnet_pid get ( ) to_vec ( ) ] , } ; let system_subnet = SubnetRecord { membership : vec ! [ node_pid get ( ) to_vec ( ) ] , subnet_type : i32 :: from ( SubnetType :: System ) , replica_version_id : VERSION_REPLICA_ID . to_string ( ) , unit_delay_millis : 600 , gossip_config : Some ( build_default_gossip_config ( ) ) , .. Default :: default ( ) } ; vec ! [ insert ( make_subnet_list_record_key ( ) as_bytes ( ) to_vec ( ) encode_or_panic ( subnet_list ) ) insert ( make_subnet_record_key ( subnet_pid ) as_bytes ( ) to_vec ( ) encode_or_panic ( system_subnet ) ) insert ( make_routing_table_record_key ( ) as_bytes ( ) to_vec ( ) encode_or_panic ( RoutingTablePB default ( ) ) ) insert ( make_node_record_key ( node_pid ) as_bytes ( ) to_vec ( ) encode_or_panic ( node ) ) insert ( make_replica_version_key ( VERSION_REPLICA_ID ) as_bytes ( ) to_vec ( ) encode_or_panic ( replica_version ) ) insert ( make_blessed_replica_version_key ( ) as_bytes ( ) to_vec ( ) encode_or_panic ( blessed_replica_version ) ) ] }
Returns a mutation that sets the initial state of the registry to be
compliant with its invariants.
Returns a mutation that sets the initial state of the registry to be compliant with its invariants .