pub(crate) fn uninstall_code(
        &self,
        canister_id: CanisterId,
        sender: PrincipalId,
        state: &mut ReplicatedState,
    ) -> Result<(), CanisterManagerError> {
        let time = state.time();
        let path = state.path().to_owned();
        let canister = match state.canister_state_mut(&canister_id) {
            Some(canister) => canister,
            None => return Err(CanisterManagerError::CanisterNotFound(canister_id)),
        };

        // Skip the controller validation if the sender is the governance
        // canister. The governance canister can forcefully
        // uninstall the code of any canister.
        if sender != GOVERNANCE_CANISTER_ID.get() {
            if let Err(err) = self.validate_controller(canister, &sender) {
                return Err(err);
            }
        }

        let rejects = uninstall_canister(&self.log, canister, &path, time);
        crate::util::process_responses(
            rejects,
            state,
            Arc::clone(&self.ingress_history_writer),
            self.log.clone(),
        );
        Ok(())
    }
/// Uninstalls code from a canister.
///
/// See https://sdk.dfinity.org/docs/interface-spec/index.html#ic-uninstall_code
Uninstalls code from a canister.
Uninstalls code from a canister .
pub(crate) fn uninstall_code(
        &self,
        canister_id: CanisterId,
        sender: PrincipalId,
        state: &mut ReplicatedState,
    ) -> Result<(), CanisterManagerError> {
        let time = state.time();
        let path = state.path().to_owned();
        let canister = match state.canister_state_mut(&canister_id) {
            Some(canister) => canister,
            None => return Err(CanisterManagerError::CanisterNotFound(canister_id)),
        };
        // Skip the controller validation if the sender is the governance
        // canister. The governance canister can forcefully
        // uninstall the code of any canister.
        if sender != GOVERNANCE_CANISTER_ID.get() {
            if let Err(err) = self.validate_controller(canister, &sender) {
                return Err(err);
            }
        }
        let rejects = uninstall_canister(&self.log, canister, &path, time);
        crate::util::process_responses(
            rejects,
            state,
            Arc::clone(&self.ingress_history_writer),
            self.log.clone(),
        );
        Ok(())
    }
pub ( crate ) fn uninstall_code ( & self , canister_id : CanisterId , sender : PrincipalId , state : & mut ReplicatedState , ) -> Result < ( ) , CanisterManagerError > { let time = state . time ( ) ; let path = state . path ( ) . to_owned ( ) ; let canister = match state . canister_state_mut ( & canister_id ) { Some ( canister ) => canister , None => return Err ( CanisterManagerError :: CanisterNotFound ( canister_id ) ) , } ; // Skip the controller validation if the sender is the governance // canister. The governance canister can forcefully // uninstall the code of any canister. if sender != GOVERNANCE_CANISTER_ID . get ( ) { if let Err ( err ) = self . validate_controller ( canister , & sender ) { return Err ( err ) ; } } let rejects = uninstall_canister ( & self . log , canister , & path , time ) ; crate :: util :: process_responses ( rejects , state , Arc :: clone ( & self . ingress_history_writer ) , self . log . clone ( ) , ) ; Ok ( ( ) ) }
Uninstalls code from a canister.
Uninstalls code from a canister .
&self
canister_id
CanisterId
sender
PrincipalId
state
&mut ReplicatedState
&self
canister_id
CanisterId
sender
PrincipalId
state
&mut ReplicatedState