Skip to main content

invoke_finalizer_async

Function invoke_finalizer_async 

Source
pub async fn invoke_finalizer_async(
    store: &mut Store<StoreData>,
    packages: &[LinkedPackageModule<'_>],
    call: FinalizerCall<'_>,
) -> Result<(), FinalizerError>
Expand description

Runs call.package’s finalizer(key, value) in a fresh store.

store must be unused: this installs the runtime and packages, the package and its dependencies at the versions the caller chose, then runs their initializers. The store is in finalizing mode from the start, so neither initializers nor the finalizer can change finalizer registrations. Calls are attributed to the package whose code makes them, as in any run.

The caller keeps what bounds the run: the store’s fuel, memory and output, a deadline (RuntimeConfig::arm_timeout with a timeout around this future), and the host services and capability checks in the store’s data. Whether this future completes or is dropped, the caller must then drain store.data_mut().blocking_work.

Every thread polling this future must meet RuntimeConfig::native_stack_size’s caller contract.