refactor: use CanisterManagerResponse in CanisterManager#9652
refactor: use CanisterManagerResponse in CanisterManager#9652
Conversation
| Ok(CanisterManagerResponse { | ||
| canister_id: canister.canister_id(), | ||
| reply: Some(EmptyBlob.encode()), | ||
| heap_delta_increase: NumBytes::new(0), |
There was a problem hiding this comment.
@maksymar Shouldn't there a heap delta be here from resized logs? I don't think this is a problem with this PR, but something that is missing from the log implementation.
If anything, this is a sign that this PR's refactor is very useful to make things like that obvious.
| resource_saturation, | ||
| ); | ||
|
|
||
| match result { |
There was a problem hiding this comment.
This match statement seems to be exactly the same everywhere? Could this be made a function on CanisterManagerResponse?
There was a problem hiding this comment.
I could change
fn process_canister_manager_response(
&self,
response: CanisterManagerResponse,
...
) -> ExecuteSubnetMessageResult {
to
fn process_canister_manager_result(
&self,
result: Result<CanisterManagerResponse, CanisterManagerError>,
...
) -> ExecuteSubnetMessageResult {
| let canister = match canister_make_mut(args.get_canister_id(), state) { | ||
| Ok(canister) => canister, | ||
| Err(err) => { | ||
| return ExecuteSubnetMessageResult::Finished { | ||
| response: Err(err), | ||
| refund: msg.take_cycles(), | ||
| }; | ||
| } | ||
| }; |
There was a problem hiding this comment.
This is also the same everywhere, but will be simplified in the final refactoring PR introducing a helper function passing a clone of the canister state (instead of the actual canister state).
This PR makes
CanisterManagerreturnCanisterManagerResponse(instead of ad-hoc return types) for the following endpoints:start_canister;update_settings;provisional_top_up_canister;upload_chunk;clear_chunk_store.