Skip to main content

start

Macro start 

Source
macro_rules! start {
    () => { ... };
    (participant) => { ... };
    (
        init($($init_arg:ident : $init_ty:ty),* $(,)?) => $init:path;
        post_upgrade($($upgrade_arg:ident : $upgrade_ty:ty),* $(,)?) => $post_upgrade:path;
    ) => { ... };
}
Expand description

Include the generated private actor module emitted by build_canister!.

The zero-argument form owns hidden install and post-upgrade lifecycle entries for canisters without application hooks. Applications that own the complete lifecycle root use participant mode and invoke the matching hidden IcyDB participant synchronously:

ⓘ
icydb::start!(participant);

#[ic_cdk::init]
fn init() {
    crate::__icydb_lifecycle_participant::init();
}

#[ic_cdk::post_upgrade]
fn post_upgrade() {
    crate::__icydb_lifecycle_participant::post_upgrade();
}

Applications that want IcyDB to own the lifecycle exports while running application callbacks afterward use the composed form:

ⓘ
icydb::start! {
    init(args: InitArgs) => application::init;
    post_upgrade() => application::post_upgrade;
}

IcyDB registers its startup watchdog before invoking either callback. The callback remains application-owned and must observe startup_state() before restoring timers, caches, or other database-dependent state.