CanDBAdmin

CanDBAdmin - asynchronous child canister control utility methods to be called by the IndexCanister

type InterCanisterActionResult = {#ok; #err : Text}

type CanisterCleanupStatusMap = { transfer : RBT.Tree<Text, InterCanisterActionResult>; stop : RBT.Tree<Text, InterCanisterActionResult>; delete : RBT.Tree<Text, InterCanisterActionResult> }

public func transferCyclesStopAndDeleteCanisters(canisterIds : [Text]) : async CanisterCleanupStatusMap

Cleans up a list of canisterIds in parallel. Returns the resulting status of each of the canisterIds after cleanup

  1. Calls the TransferCycles method of each actor
  2. Stops each canistier
  3. Deletes each canister

public func transferAllCycles(canisterIds : [Text]) : async InterCanisterStatusMap

Attempts to transfer cycles from canisters (by canisterId) to the calling canister

canisterIds - each of the canisterIds that will transfer cycles to the calling canister

public func stopAllCanisters(canisterPrincipals : [Principal]) : async InterCanisterStatusMap

Attempts to stop each of the canisters (by Principal) from the calling canister

canisterPrincipals - each of the canisterPrincipals of the canisters that will be stopped

public func deleteAllCanisters(canisterPrincipals : [Principal]) : async InterCanisterStatusMap

Attempts to delete each of the canisters (by Principal) from the calling canister

canisterPrincipals - each of the canisterPrincipals of the canisters that will be deleted

type UpgradePKRangeOptions = { canisterMap : CanisterMap.CanisterMap; lowerPK : Text; upperPK : Text; limit : Nat; wasmModule : Blob; scalingOptions : CanDB.ScalingOptions; owners : ?[Principal] }

type UpgradePKRangeResult = { upgradeCanisterResults : [(Text, InterCanisterActionResult)]; nextKey : ?Text }

public func upgradeCanistersInPKRange() : async UpgradePKRangeResult

Upgrades up to 5 PK (potentially multiple canisters per PK) at a time in a PK range

public func upgradeCanistersByPK(
  canisterMap : CanisterMap.CanisterMap,
  pk : Text,
  wasmModule : Blob,
  scalingOptions : CanDB.ScalingOptions
) : async [(Text, InterCanisterActionResult)]

Upgrades all canisters for a specific PK