Skip to main content

daemon_main

Macro daemon_main 

Source
macro_rules! daemon_main {
    (
        daemon: $daemon:expr,
        keypair: $keypair:expr,
        config: $config:expr,
        dispatcher: $dispatcher:expr $(,)?
    ) => { ... };
}
Expand description

One-call macro for the common “single daemon per process” case. Expands to a tokio::main body that:

  1. Constructs a MeshOsRuntime via the supplied config + dispatcher,
  2. Wraps the runtime in MeshOsDaemonSdk,
  3. Registers the supplied daemon + keypair,
  4. Drains control events; on Shutdown or DrainFinish, breaks the loop,
  5. Drives graceful_shutdown on the handle, then shutdown on the SDK.
daemon_main! {
    name: "my-telemetry",
    daemon: MyTelemetryDaemon::new(),
    keypair: EntityKeypair::generate(),
    config: MeshOsConfig::default(),
    dispatcher: my_dispatcher,
}