/// Bless a new replica version by mutating the registry canister.
Bless a new replica version by mutating the registry canister.
Bless a new replica version by mutating the registry canister .
pub fn bless_replica_version(
    agent: &Agent,
    player: &crate::Player,
    replica_version_id: String,
    context_time: Time,
) -> Result<SignedIngress, String> {
    let mut mutation = RegistryMutation::default();
    mutation.set_mutation_type(registry_mutation::Type::Upsert);
    mutation.key = make_blessed_replica_version_key().into_bytes();
    let mut blessed_versions = player.get_blessed_replica_versions(context_time)?;
    blessed_versions
        .blessed_version_ids
        .push(replica_version_id);
    let mut buf = Vec::new();
    match blessed_versions.encode(&mut buf) {
        Ok(_) => mutation.value = buf,
        Err(error) => panic!("Error encoding the value to protobuf: {:?}", error),
    }
    atomic_mutate(
        agent,
        REGISTRY_CANISTER_ID,
        vec![mutation],
        vec![],
        context_time + Duration::from_secs(60),
    )
}
pub fn bless_replica_version ( agent : & Agent , player : & crate :: Player , replica_version_id : String , context_time : Time , ) -> Result < SignedIngress , String > { let mut mutation = RegistryMutation :: default ( ) ; mutation . set_mutation_type ( registry_mutation :: Type :: Upsert ) ; mutation . key = make_blessed_replica_version_key ( ) . into_bytes ( ) ; let mut blessed_versions = player . get_blessed_replica_versions ( context_time ) ? ; blessed_versions . blessed_version_ids . push ( replica_version_id ) ; let mut buf = Vec :: new ( ) ; match blessed_versions . encode ( & mut buf ) { Ok ( _ ) => mutation . value = buf , Err ( error ) => panic ! ( " " error ) , } atomic_mutate ( agent , REGISTRY_CANISTER_ID , vec ! [ mutation ] , vec ! [ ] , context_time + Duration :: from_secs ( 60 ) , ) }
Bless a new replica version by mutating the registry canister.
Bless a new replica version by mutating the registry canister .
agent
&Agent
player
&crate::Player
replica_version_id
String
context_time
Time