canic_core/api/
lifecycle.rs1use crate::{
2 dto::{abi::v1::CanisterInitPayload, subnet::SubnetIdentity},
3 ids::CanisterRole,
4 lifecycle,
5};
6
7pub struct LifecycleApi;
12
13impl LifecycleApi {
14 pub fn init_root_canister_before_bootstrap(
15 identity: SubnetIdentity,
16 config_str: &str,
17 config_path: &str,
18 ) {
19 lifecycle::init::init_root_canister_before_bootstrap(identity, config_str, config_path);
20 }
21
22 pub fn schedule_init_root_bootstrap() {
23 lifecycle::init::schedule_init_root_bootstrap();
24 }
25
26 pub fn post_upgrade_root_canister_before_bootstrap(config_str: &str, config_path: &str) {
27 lifecycle::upgrade::post_upgrade_root_canister_before_bootstrap(config_str, config_path);
28 }
29
30 pub fn schedule_post_upgrade_root_bootstrap() {
31 lifecycle::upgrade::schedule_post_upgrade_root_bootstrap();
32 }
33
34 pub fn init_nonroot_canister_before_bootstrap(
35 role: CanisterRole,
36 payload: CanisterInitPayload,
37 config_str: &str,
38 config_path: &str,
39 ) {
40 lifecycle::init::init_nonroot_canister_before_bootstrap(
41 role,
42 payload,
43 config_str,
44 config_path,
45 );
46 }
47
48 pub fn schedule_init_nonroot_bootstrap(args: Option<Vec<u8>>) {
49 lifecycle::init::schedule_init_nonroot_bootstrap(args);
50 }
51
52 pub fn post_upgrade_nonroot_canister_before_bootstrap(
53 role: CanisterRole,
54 config_str: &str,
55 config_path: &str,
56 ) {
57 lifecycle::upgrade::post_upgrade_nonroot_canister_before_bootstrap(
58 role,
59 config_str,
60 config_path,
61 );
62 }
63
64 pub fn schedule_post_upgrade_nonroot_bootstrap() {
65 lifecycle::upgrade::schedule_post_upgrade_nonroot_bootstrap();
66 }
67}