1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Process-level init / shutdown for the cabi surface.
//!
//! `blazen_init` warms up the cabi tokio runtime and delegates to
//! `blazen_uniffi::init` so the UniFFI-managed runtime and the tracing
//! subscriber are also primed. `blazen_shutdown` flushes telemetry
//! exporters via `blazen_uniffi::shutdown_telemetry`.
//!
//! Both calls are idempotent — FFI hosts typically invoke `blazen_init`
//! once at process start and `blazen_shutdown` once at process exit, but
//! repeat calls are safe.
use crateruntime;
/// Initialises the blazen-cabi runtime: builds the cabi tokio runtime if it
/// hasn't been built yet, and delegates to `blazen_uniffi::init` to warm the
/// UniFFI-managed runtime + install a default tracing subscriber when none
/// is already set globally.
///
/// Idempotent — safe to call multiple times from any thread. Returns `0`
/// on success. No failure modes today, but the return slot is reserved so
/// future fallible initialisation can surface a non-zero status without an
/// ABI break.
pub extern "C"
/// Flushes telemetry exporters and shuts down background tasks owned by the
/// blazen telemetry stack. Idempotent — safe to call multiple times and from
/// any thread. Returns `0` on success.
///
/// This does NOT tear down the tokio runtime — runtimes are leaked at
/// process exit on purpose (matching the rest of the workspace). FFI hosts
/// only need to call this to ensure traces / metrics / langfuse spans get
/// drained before the process dies.
pub extern "C"