canic_core/api/lifecycle/
nonroot.rs1use crate::{
2 config::RoleRuntimeAuthority,
3 dto::{
4 abi::v1::CanisterInitPayload, env::EnvBootstrapArgs,
5 fleet_subnet_root::FleetSubnetWasmStoreInitArgs,
6 },
7 ids::{CanisterRole, ManagedCanisterBinding},
8 lifecycle,
9};
10
11pub struct LifecycleApi;
16
17impl LifecycleApi {
18 #[doc(hidden)]
19 pub fn configure_component_runtime_with_automatic_topup(
20 request: crate::dto::component_registry::ComponentRuntimeDirectoryPreparationRequest,
21 ) -> Result<
22 crate::view::fleet_activation::ComponentRuntimeActivationTransition,
23 crate::dto::error::Error,
24 > {
25 crate::workflow::component_runtime::configure_with_automatic_topup(request)
26 .map_err(Into::into)
27 }
28
29 pub fn managed_binding() -> Result<ManagedCanisterBinding, crate::dto::error::Error> {
31 crate::ops::runtime::env::EnvOps::managed_binding().map_err(Into::into)
32 }
33
34 pub fn init_nonroot_canister_before_bootstrap(
35 role: CanisterRole,
36 payload: CanisterInitPayload,
37 application_init_args: Option<Vec<u8>>,
38 embedded_release_build_id: Option<&str>,
39 authority: RoleRuntimeAuthority,
40 ) {
41 lifecycle::init::nonroot::init_nonroot_canister_before_bootstrap(
42 role,
43 payload,
44 application_init_args,
45 embedded_release_build_id,
46 authority,
47 );
48 }
49
50 pub fn init_nonroot_canister_with_fleet_admission_before_bootstrap(
52 role: CanisterRole,
53 payload: CanisterInitPayload,
54 application_init_args: Option<Vec<u8>>,
55 embedded_release_build_id: Option<&str>,
56 authority: RoleRuntimeAuthority,
57 ) {
58 lifecycle::init::nonroot::init_nonroot_canister_with_fleet_admission_before_bootstrap(
59 role,
60 payload,
61 application_init_args,
62 embedded_release_build_id,
63 authority,
64 );
65 }
66
67 pub fn init_wasm_store_before_bootstrap(
68 input: FleetSubnetWasmStoreInitArgs,
69 embedded_release_build_id: Option<&str>,
70 authority: RoleRuntimeAuthority,
71 ) {
72 lifecycle::init::nonroot::init_wasm_store_before_bootstrap(
73 input,
74 embedded_release_build_id,
75 authority,
76 );
77 }
78
79 pub fn schedule_init_nonroot_bootstrap() {
80 lifecycle::init::nonroot::schedule_init_nonroot_bootstrap();
81 }
82
83 pub fn init_local_nonroot_canister_before_bootstrap(
84 role: CanisterRole,
85 env: EnvBootstrapArgs,
86 authority: RoleRuntimeAuthority,
87 ) {
88 lifecycle::init::nonroot::init_local_nonroot_canister_before_bootstrap(
89 role, env, authority,
90 );
91 }
92
93 #[doc(hidden)]
94 pub fn init_local_nonroot_canister_with_automatic_topup_before_bootstrap(
95 role: CanisterRole,
96 env: EnvBootstrapArgs,
97 authority: RoleRuntimeAuthority,
98 ) {
99 lifecycle::init::nonroot::init_local_nonroot_canister_with_automatic_topup_before_bootstrap(
100 role, env, authority,
101 );
102 }
103
104 #[must_use]
105 pub fn post_upgrade_wasm_store_before_bootstrap(
106 embedded_release_build_id: Option<&str>,
107 authority: RoleRuntimeAuthority,
108 ) -> bool {
109 lifecycle::upgrade::nonroot::post_upgrade_wasm_store_before_bootstrap(
110 embedded_release_build_id,
111 authority,
112 )
113 }
114
115 #[must_use]
116 pub fn post_upgrade_nonroot_canister_before_bootstrap(
117 role: CanisterRole,
118 embedded_release_build_id: Option<&str>,
119 authority: RoleRuntimeAuthority,
120 ) -> bool {
121 lifecycle::upgrade::nonroot::post_upgrade_nonroot_canister_before_bootstrap(
122 role,
123 embedded_release_build_id,
124 authority,
125 )
126 }
127
128 #[must_use]
130 pub fn post_upgrade_nonroot_canister_with_fleet_admission_before_bootstrap(
131 role: CanisterRole,
132 embedded_release_build_id: Option<&str>,
133 authority: RoleRuntimeAuthority,
134 ) -> bool {
135 lifecycle::upgrade::nonroot::post_upgrade_nonroot_canister_with_fleet_admission_before_bootstrap(
136 role,
137 embedded_release_build_id,
138 authority,
139 )
140 }
141
142 #[doc(hidden)]
143 #[must_use]
144 pub fn post_upgrade_nonroot_canister_with_automatic_topup_before_bootstrap(
145 role: CanisterRole,
146 embedded_release_build_id: Option<&str>,
147 authority: RoleRuntimeAuthority,
148 ) -> bool {
149 lifecycle::upgrade::nonroot::post_upgrade_nonroot_canister_with_automatic_topup_before_bootstrap(
150 role,
151 embedded_release_build_id,
152 authority,
153 )
154 }
155
156 #[must_use]
158 pub fn post_upgrade_nonroot_canister_with_automatic_topup_and_fleet_admission_before_bootstrap(
159 role: CanisterRole,
160 embedded_release_build_id: Option<&str>,
161 authority: RoleRuntimeAuthority,
162 ) -> bool {
163 lifecycle::upgrade::nonroot::post_upgrade_nonroot_canister_with_automatic_topup_and_fleet_admission_before_bootstrap(
164 role,
165 embedded_release_build_id,
166 authority,
167 )
168 }
169
170 pub fn schedule_post_upgrade_nonroot_bootstrap() {
171 lifecycle::upgrade::nonroot::schedule_post_upgrade_nonroot_bootstrap();
172 }
173
174 #[must_use]
175 pub fn post_upgrade_local_nonroot_canister_before_bootstrap(
176 role: CanisterRole,
177 authority: RoleRuntimeAuthority,
178 ) -> bool {
179 lifecycle::upgrade::nonroot::post_upgrade_local_nonroot_canister_before_bootstrap(
180 role, authority,
181 )
182 }
183
184 #[doc(hidden)]
185 #[must_use]
186 pub fn post_upgrade_local_nonroot_canister_with_automatic_topup_before_bootstrap(
187 role: CanisterRole,
188 authority: RoleRuntimeAuthority,
189 ) -> bool {
190 lifecycle::upgrade::nonroot::post_upgrade_local_nonroot_canister_with_automatic_topup_before_bootstrap(
191 role,
192 authority,
193 )
194 }
195}