pub(crate) fn update_settings(
        &self,
        sender: PrincipalId,
        canister_id: CanisterId,
        settings: CanisterSettings,
        state: &mut ReplicatedState,
    ) -> Result<(), CanisterManagerError> {
        let compute_allocation_used = state.total_compute_allocation();
        let memory_allocation_used = state.total_memory_allocation_used();
        let canister = state
            .canister_state_mut(&canister_id)
            .ok_or_else(|| CanisterManagerError::CanisterNotFound(canister_id))?;

        // Verify controller.
        self.validate_controller(&canister, &sender)?;
        self.validate_compute_allocation(
            compute_allocation_used,
            &canister,
            settings.compute_allocation(),
        )?;
        self.validate_memory_allocation(
            memory_allocation_used,
            &canister,
            settings.memory_allocation(),
        )?;

        let validated_settings = ValidatedCanisterSettings::from(settings);
        self.do_update_settings(validated_settings, canister);

        Ok(())
    }
/// Tries to apply the requested settings on the canister identified by
/// `canister_id`.
Tries to apply the requested settings on the canister identified by
`canister_id`.
Tries to apply the requested settings on the canister identified by ` canister_id ` .
pub(crate) fn update_settings(
        &self,
        sender: PrincipalId,
        canister_id: CanisterId,
        settings: CanisterSettings,
        state: &mut ReplicatedState,
    ) -> Result<(), CanisterManagerError> {
        let compute_allocation_used = state.total_compute_allocation();
        let memory_allocation_used = state.total_memory_allocation_used();
        let canister = state
            .canister_state_mut(&canister_id)
            .ok_or_else(|| CanisterManagerError::CanisterNotFound(canister_id))?;
        // Verify controller.
        self.validate_controller(&canister, &sender)?;
        self.validate_compute_allocation(
            compute_allocation_used,
            &canister,
            settings.compute_allocation(),
        )?;
        self.validate_memory_allocation(
            memory_allocation_used,
            &canister,
            settings.memory_allocation(),
        )?;
        let validated_settings = ValidatedCanisterSettings::from(settings);
        self.do_update_settings(validated_settings, canister);
        Ok(())
    }
pub ( crate ) fn update_settings ( & self , sender : PrincipalId , canister_id : CanisterId , settings : CanisterSettings , state : & mut ReplicatedState , ) -> Result < ( ) , CanisterManagerError > { let compute_allocation_used = state . total_compute_allocation ( ) ; let memory_allocation_used = state . total_memory_allocation_used ( ) ; let canister = state . canister_state_mut ( & canister_id ) . ok_or_else ( | | CanisterManagerError :: CanisterNotFound ( canister_id ) ) ? ; // Verify controller. self . validate_controller ( & canister , & sender ) ? ; self . validate_compute_allocation ( compute_allocation_used , & canister , settings . compute_allocation ( ) , ) ? ; self . validate_memory_allocation ( memory_allocation_used , & canister , settings . memory_allocation ( ) , ) ? ; let validated_settings = ValidatedCanisterSettings :: from ( settings ) ; self . do_update_settings ( validated_settings , canister ) ; Ok ( ( ) ) }
Tries to apply the requested settings on the canister identified by
`canister_id`.
Tries to apply the requested settings on the canister identified by ` canister_id ` .
&self
sender
PrincipalId
canister_id
CanisterId
settings
CanisterSettings
state
&mut ReplicatedState
&self
sender
PrincipalId
canister_id
CanisterId
settings
CanisterSettings
state
&mut ReplicatedState