// Execute a query method from an inter-canister request.
Execute a query method from an inter-canister request.
Execute a query method from an inter - canister request .
fn execute_query_method_for_request(
        &self,
        canister: CanisterState,
        req: Request,
        cycles: NumInstructions,
        time: Time,
    ) -> ExecuteMessageResult<CanisterState> {
        // Letting the canister grow arbitrarily when executing the
        // query is fine as we do not persist state modifications.
        let subnet_available_memory =
            SubnetAvailableMemory::new(self.config.subnet_memory_capacity.get() as i64);
        let execution_parameters = self.execution_parameters(
            &canister,
            cycles,
            subnet_available_memory,
            ExecutionMode::Replicated,
        );
        let (mut canister, cycles, result) = self.hypervisor.execute_query(
            QueryExecutionType::Replicated,
            req.method_name.as_str(),
            req.method_payload.as_slice(),
            *req.sender.get_ref(),
            canister,
            None,
            time,
            execution_parameters,
        );
        let result = result
            .map_err(|err| self.log_and_transform_to_user_error(err, &canister.canister_id()));
        let response_payload = Payload::from(result);
        canister.push_output_response(Response {
            originator: req.sender,
            respondent: canister.canister_id(),
            originator_reply_callback: req.sender_reply_callback,
            refund: Cycles::zero(),
            response_payload,
        });
        ExecuteMessageResult {
            canister,
            num_instructions_left: cycles,
            ingress_status: None,
            heap_delta: NumBytes::from(0),
        }
    }
fn execute_query_method_for_request ( & self , canister : CanisterState , req : Request , cycles : NumInstructions , time : Time , ) -> ExecuteMessageResult < CanisterState > { // Letting the canister grow arbitrarily when executing the // query is fine as we do not persist state modifications. let subnet_available_memory = SubnetAvailableMemory :: new ( self . config . subnet_memory_capacity . get ( ) as i64 ) ; let execution_parameters = self . execution_parameters ( & canister , cycles , subnet_available_memory , ExecutionMode :: Replicated , ) ; let ( mut canister , cycles , result ) = self . hypervisor . execute_query ( QueryExecutionType :: Replicated , req . method_name . as_str ( ) , req . method_payload . as_slice ( ) , * req . sender . get_ref ( ) , canister , None , time , execution_parameters , ) ; let result = result . map_err ( | err | self . log_and_transform_to_user_error ( err , & canister . canister_id ( ) ) ) ; let response_payload = Payload :: from ( result ) ; canister . push_output_response ( Response { originator : req . sender , respondent : canister . canister_id ( ) , originator_reply_callback : req . sender_reply_callback , refund : Cycles :: zero ( ) , response_payload , } ) ; ExecuteMessageResult { canister , num_instructions_left : cycles , ingress_status : None , heap_delta : NumBytes :: from ( 0 ) , } }
Execute a query method from an inter-canister request.
Execute a query method from an inter - canister request .
&self
canister
CanisterState
req
Request
cycles
NumInstructions
time
Time