Crate polkadot_node_subsystem::gen
source · Expand description
Orchestra
orchestra
provides a global information flow of what a token of information.
The token is arbitrary, but is used to notify all Subsystem
s of what is relevant
and what is not.
For the motivations behind implementing the orchestra itself you should check out that guide, documentation in this crate will focus and be of technical nature.
An Orchestra
is something that allows spawning/stopping and orchestrating
asynchronous tasks as well as establishing a well-defined and easy to use
protocol that the tasks can use to communicate with each other. It is desired
that this protocol is the only way tasks communicate with each other, however
at this moment there are no foolproof guards against other ways of communication.
The Orchestra
is instantiated with a pre-defined set of Subsystems
that
share the same behavior from Orchestra
’s point of view.
+-----------------------------+
| Orchesta |
+-----------------------------+
................| Orchestra "holds" these and uses |.............
. them to (re)start things .
. .
. +-------------------+ +---------------------+ .
. | Subsystem1 | | Subsystem2 | .
. +-------------------+ +---------------------+ .
. | | .
..................................................................
| |
start() start()
V V
..................| Orchestra "runs" these |.......................
. +--------------------+ +---------------------+ .
. | SubsystemInstance1 | <-- bidir --> | SubsystemInstance2 | .
. +--------------------+ +---------------------+ .
..................................................................
Modules
- Abstractions for asynchronous programming.
- Metered variant of mpsc channels to be able to extract metrics.
- A scoped, structured logging and diagnostics system.
Macros
- A macro which returns the result of polling a future once within the current
async
context. - Polls multiple futures and streams simultaneously, executing the branch for the future that finishes first. If multiple futures are ready, one will be pseudo-randomly selected at runtime. Futures directly passed to
select!
must beUnpin
and implementFusedFuture
.
Structs
- The context of an asynchronous task.
- A future representing the notification that an elapsed duration has occurred.
- A
Duration
type to represent a span of time, typically used for system timeouts. - Future for the
fuse
method. - A set of futures which may complete in any order.
- A wrapping type for messages.
- A pinned pointer.
- Watermark to track the received signals.
- An asynchronous subsystem task..
- A running instance of some
Subsystem
. - Set of readouts of the
Meter
s of a subsystem. - Collection of meters related to a subsystem.
- A future that wraps another future with a
Delay
allowing for time-limited futures.
Enums
- A message type that a subsystem receives from an orchestra. It wraps signals from an orchestra and messages that are circulating between subsystems.
- An error type that describes faults that may happen
- Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.
- Type to tell
SelectWithStrategy
which stream to poll next. - A type of messages that are sent from a
Subsystem
to the declared orchestra.
Traits
- A trait to support the origin annotation such that errors across subsystems can be easier tracked.
- A future represents an asynchronous computation obtained by use of
async
. - An extension trait for
Future
s that provides a variety of convenient adapters. - A helper trait to map a subsystem to smth. else.
- A spawner
- An extension trait for
Stream
s that provides a variety of convenient combinator functions. - Sender end of a channel to interface with a subsystem.
- Extends
Future
to allow time-limited futures.
Functions
- Create a packet from its parts.
- This function will attempt to pull items from both streams. Each stream will be polled in a round-robin fashion, and whenever a stream is ready to yield an item that item is yielded.
- A functor to specify strategy of the channels selection in the
SubsystemIncomingMessages
- This function will attempt to pull items from both streams. You provide a closure to tell
SelectWithStrategy
which stream to poll. The closure can store state onSelectWithStrategy
to which it will receive a&mut
on every invocation. This allows basing the strategy on prior choices.
Type Definitions
- An owned dynamically typed
Future
for use in cases where you can’t statically type your result or need to add some indirection. - Alias for a result with error type
OrchestraError
. - Incoming messages from both the bounded and unbounded channel.