Module tokio

Module tokio 

Source
Expand description

A production-focused runtime based on Tokio with secure randomness and storage backed by the local filesystem.

§Panics

Unless configured otherwise, any task panic will lead to a runtime panic.

§Example

use commonware_runtime::{Spawner, Runner, tokio, Metrics};

let executor = tokio::Runner::default();
executor.start(|context| async move {
    println!("Parent started");
    let result = context.with_label("child").spawn(|_| async move {
        println!("Child started");
        "hello"
    });
    println!("Child result: {:?}", result.await);
    println!("Parent exited");
});

Modules§

telemetry
Utilities for collecting and reporting telemetry data.
tracing
Utilities to export traces to an OTLP endpoint.

Structs§

Config
Configuration for the tokio runtime.
Context
Implementation of crate::Spawner, crate::Clock, crate::Network, and crate::Storage for the tokio runtime.
Executor
Runtime based on Tokio.
NetworkConfig
Runner
Implementation of crate::Runner for the tokio runtime.