Crate gen
Expand description
§Orchestra
orchestra provides a global information flow system in reference to system specifc
process tokens.
The token is arbitrary, but is used to notify all Subsystems of what is relevant
and what is not, leading to a so called view of active tokens.
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 - called Subsystems in the orchestra
scope - communicate with each other, but that is not enforced and is the responsibility
of the developer.
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§
- futures
- Abstractions for asynchronous programming.
- metered
- Metered variant of mpsc channels to be able to extract metrics.
- tracing
- A scoped, structured logging and diagnostics system.
Macros§
- poll
- A macro which returns the result of polling a future once within the
current
asynccontext. - select
- 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 beUnpinand implementFusedFuture.
Structs§
- Context
- The context of an asynchronous task.
- Delay
- A future representing the notification that an elapsed duration has occurred.
- Duration
- A
Durationtype to represent a span of time, typically used for system timeouts. - Fuse
- Future for the
fusemethod. - Futures
Unordered - A set of futures which may complete in any order.
- High
Priority - High priority.
- Message
Packet - A wrapping type for messages.
- Normal
Priority - Normal priority.
- Pin
- A pointer which pins its pointee in place.
- Signals
Received - Watermark to track the received signals.
- Spawned
Subsystem - An asynchronous subsystem task..
- Subsystem
Instance - A running instance of some
Subsystem. - Subsystem
Meter Readouts - Set of readouts of the
Meters of a subsystem. - Subsystem
Meters - Collection of meters related to a subsystem.
- Timeout
- A future that wraps another future with a
Delayallowing for time-limited futures.
Enums§
- From
Orchestra - A message type that a subsystem receives from an orchestra. It wraps signals from an orchestra and messages that are circulating between subsystems.
- Orchestra
Error - An error type that describes faults that may happen
- Poll
- Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.
- Poll
Next - Type to tell
SelectWithStrategywhich stream to poll next. - Priority
Level - Priority of messages sending to the individual subsystems. Only for the bounded channel sender.
- ToOrchestra
- A type of messages that are sent from a
Subsystemto the declared orchestra. - TrySend
Error - A bounded channel error when trying to send a message (transparently wraps the inner error type)
Traits§
- Annotate
Error Origin - A trait to support the origin annotation such that errors across subsystems can be easier tracked.
- Future
- A future represents an asynchronous computation obtained by use of
async. - Future
Ext - An extension trait for
Futures that provides a variety of convenient adapters. - MapSubsystem
- A helper trait to map a subsystem to smth. else.
- Priority
- Describes the priority of the message.
- Spawner
- A spawner
- Stream
Ext - An extension trait for
Streams that provides a variety of convenient combinator functions. - Subsystem
- A trait that describes the
Subsystems that can run on theOrchestra. - Subsystem
Context - A context type that is given to the
Subsystemupon spawning. It can be used bySubsystemto communicate with otherSubsystems or spawn jobs. - Subsystem
Sender - Sender end of a channel to interface with a subsystem.
- Timeout
Ext - Extends
Futureto allow time-limited futures.
Functions§
- make_
packet - Create a packet from its parts.
- select
- 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.
- select_
message_ channel_ strategy - A functor to specify strategy of the channels selection in the
SubsystemIncomingMessages - select_
with_ strategy - This function will attempt to pull items from both streams. You provide a
closure to tell
SelectWithStrategywhich stream to poll. The closure can store state onSelectWithStrategyto which it will receive a&muton every invocation. This allows basing the strategy on prior choices.
Type Aliases§
- BoxFuture
- An owned dynamically typed
Futurefor use in cases where you can’t statically type your result or need to add some indirection. - Orchestra
Result - Alias for a result with error type
OrchestraError. - Subsystem
Incoming Messages - Incoming messages from both the bounded and unbounded channel.