Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chunking api interface to management canister #1768

Merged
merged 10 commits into from
Jun 6, 2024
38 changes: 38 additions & 0 deletions canisters/management/canister_management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const CanisterSettings = Record({
});
export type CanisterSettings = typeof CanisterSettings.tsType;

export const ChunkHash = Record({
hash: blob
});
export type ChunkHash = typeof ChunkHash.tsType;

/**
* The arguments to provide to the management canister's create_canister
* method
Expand Down Expand Up @@ -89,6 +94,28 @@ export const UpdateSettingsArgs = Record({
});
export type UpdateSettingsArgs = typeof UpdateSettingsArgs.tsType;

export const UploadChunkArgs = Record({
canister_id: CanisterId,
lastmjs marked this conversation as resolved.
Show resolved Hide resolved
chunk: blob
});
export type UploadChunkArgs = typeof UploadChunkArgs.tsType;

export const UploadChunkResult = ChunkHash;
export type UploadChunkResult = typeof UploadChunkResult.tsType;

export const ClearChunkStoreArgs = Record({
canister_id: CanisterId
});
export type ClearChunkStoreArgs = typeof ClearChunkStoreArgs.tsType;

export const StoredChunksArgs = Record({
canister_id: CanisterId
});
export type StoredChunksArgs = typeof StoredChunksArgs.tsType;

export const StoredChunksResult = Vec(ChunkHash);
export type StoredChunksResult = typeof StoredChunksResult.tsType;

export const InstallCodeMode = Variant({
install: Null,
reinstall: Null,
Expand All @@ -105,6 +132,17 @@ export const InstallCodeArgs = Record({
});
export type InstallCodeArgs = typeof InstallCodeArgs.tsType;

export const InstallChunkedCodeArgs = Record({
mode: InstallCodeMode,
target_canister: CanisterId,
store_canister: Opt(CanisterId),
chunk_hashes_list: Vec(ChunkHash),
wasm_module_hash: blob,
arg: blob,
sender_canister_version: Opt(nat64)
});
export type InstallChunkedCodeArgs = typeof InstallChunkedCodeArgs.tsType;

export const UninstallCodeArgs = Record({
canister_id: CanisterId,
sender_canister_version: Opt(nat64)
Expand Down
Loading
Loading