Crate commonware_runtime

Source
Expand description

Execute asynchronous tasks with a configurable scheduler.

This crate provides a collection of runtimes that can be used to execute asynchronous tasks in a variety of ways. For production use, the tokio module provides a runtime backed by Tokio. For testing and simulation, the deterministic module provides a runtime that allows for deterministic execution of tasks (given a fixed seed).

§Status

commonware-runtime is ALPHA software and is not yet recommended for production use. Developers should expect breaking changes and occasional instability.

Modules§

deterministic
A deterministic runtime that randomly selects tasks to run based on a seed
mocks
A mock implementation of a channel that implements the Sink and Stream traits.
tokio
A production-focused runtime based on Tokio with secure randomness and storage backed by the local filesystem.

Structs§

Handle
Handle to a spawned task.
Signaler
Coordinates a one-time signal across many tasks.

Enums§

Error
Errors that can occur when interacting with the runtime.

Traits§

Blob
Interface to read and write to a blob.
Clock
Interface that any task scheduler must implement to provide time-based operations.
Listener
Interface that any runtime must implement to handle incoming network connections.
Network
Interface that any runtime must implement to create network connections.
Runner
Interface that any task scheduler must implement to start running tasks.
Sink
Interface that any runtime must implement to send messages over a network connection.
Spawner
Interface that any task scheduler must implement to spawn sub-tasks in a given root task.
Storage
Interface to interact with storage.
Stream
Interface that any runtime must implement to receive messages over a network connection.

Functions§

reschedule
Yield control back to the runtime.

Type Aliases§

Signal
A one-time broadcast that can be awaited by many tasks. It is often used for coordinating shutdown across many tasks.