Skip to content

Commit 4e628a8

Browse files
fix: Update CanisterInstallMode signature (#527)
1 parent 9a65c41 commit 4e628a8

File tree

2 files changed

+34
-4
lines changed
  • .github/workflows
  • src/ic-cdk/src/api/management_canister/main

2 files changed

+34
-4
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ${{ matrix.os }}
4444
strategy:
4545
matrix:
46-
os: [ubuntu-latest, macos-12]
46+
os: [ubuntu-latest, macos-13-large]
4747
steps:
4848
- name: Checkout repository
4949
uses: actions/checkout@v4

src/ic-cdk/src/api/management_canister/main/types.rs

+33-3
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ pub enum CanisterInstallMode {
191191
Reinstall,
192192
/// Upgrade an existing canister.
193193
#[serde(rename = "upgrade")]
194-
Upgrade(Option<SkipPreUpgrade>),
194+
Upgrade(Option<UpgradeFlags>),
195195
}
196196

197-
/// If set to true, the pre_upgrade step will be skipped during the canister upgrade
197+
/// Flags for canister installation with [`CanisterInstallMode::Upgrade`].
198198
#[derive(
199199
CandidType,
200200
Serialize,
@@ -209,7 +209,37 @@ pub enum CanisterInstallMode {
209209
Copy,
210210
Default,
211211
)]
212-
pub struct SkipPreUpgrade(pub Option<bool>);
212+
pub struct UpgradeFlags {
213+
/// If set to `true`, the `pre_upgrade` step will be skipped during the canister upgrade
214+
pub skip_pre_upgrade: Option<bool>,
215+
/// If set to `Keep`, the WASM heap memory will be preserved instead of cleared.
216+
pub wasm_memory_persistence: Option<WasmPersistenceMode>,
217+
}
218+
219+
/// WASM memory persistence setting for [`UpgradeFlags`].
220+
#[derive(
221+
CandidType,
222+
Serialize,
223+
Deserialize,
224+
Debug,
225+
PartialEq,
226+
Eq,
227+
PartialOrd,
228+
Ord,
229+
Hash,
230+
Clone,
231+
Copy,
232+
Default,
233+
)]
234+
pub enum WasmPersistenceMode {
235+
/// Preserve heap memory (only officially supported by Motoko)
236+
#[serde(rename = "keep")]
237+
Keep,
238+
/// Clear heap memory
239+
#[serde(rename = "replace")]
240+
#[default]
241+
Replace,
242+
}
213243

214244
/// WASM module.
215245
pub type WasmModule = Vec<u8>;

0 commit comments

Comments
 (0)