commonware_runtime/tokio/mod.rs
1//! A production-focused runtime based on [Tokio](https://tokio.rs) with
2//! secure randomness and storage backed by the local filesystem.
3//!
4//! # Panics
5//!
6//! Unless configured otherwise, any task panic will lead to a runtime panic.
7//!
8//! # Storage
9//!
10//! [crate::Runner::start] holds the storage directory (an advisory lock on its
11//! `.hold` file) until the run's storage and every operation it dispatched have
12//! finished. A start on a directory another run still holds blocks, with a
13//! warning, until then. A `Context`, `Storage`, or `Blob` kept past `start`
14//! keeps the hold.
15//!
16//! # Example
17//!
18//! ```rust
19//! use commonware_runtime::{Spawner, Runner, Supervisor, tokio, Metrics};
20//!
21//! let executor = tokio::Runner::default();
22//! executor.start(|context| async move {
23//! println!("Parent started");
24//! let result = context.child("child").spawn(|_| async move {
25//! println!("Child started");
26//! "hello"
27//! });
28//! println!("Child result: {:?}", result.await);
29//! println!("Parent exited");
30//! });
31//! ```
32
33mod runtime;
34pub use runtime::*;
35pub mod telemetry;
36pub mod tracing;