Clio develop
The XRP Ledger API server.
|
This namespace implements an async framework built on top of execution contexts. More...
Classes | |
class | AnyExecutionContext |
A type-erased execution context. More... | |
class | AnyOperation |
A type-erased operation that can be executed via AnyExecutionContext. More... | |
class | AnyStopToken |
A type-erased stop token. More... | |
class | AnyStrand |
A type-erased execution context. More... | |
class | BasicExecutionContext |
A highly configurable execution context. More... | |
struct | ExecutionError |
Error channel type for async operation of any ExecutionContext. More... | |
class | Outcome |
Unstoppable outcome. More... | |
class | RepeatingOperation |
The future side of async operations that automatically repeat until aborted. More... | |
class | StoppableOperation |
The future side of async operations that can be stopped. More... | |
class | StoppableOutcome |
Stoppable outcome. More... | |
class | SystemExecutionContext |
A execution context that runs tasks on a system thread pool of 1 thread. More... | |
Concepts | |
concept | SomeStoppable |
Specifies the interface for an entity that can be stopped. | |
concept | SomeCancellable |
Specifies the interface for an entity that can be cancelled. | |
concept | SomeAwaitable |
Specifies the interface for an operation that can be awaited. | |
concept | SomeAbortable |
Specifies the interface for an operation that can be aborted. | |
concept | SomeOperation |
Specifies the interface for an operation. | |
concept | SomeOperationWithData |
Specifies the interface for an operation. | |
concept | SomeStoppableOperation |
Specifies the interface for an operation that can be stopped. | |
concept | SomeCancellableOperation |
Specifies the interface for an operation that can be cancelled. | |
concept | SomeOutcome |
Specifies the interface for an outcome (promise) | |
concept | SomeStopToken |
Specifies the interface for a stop token. | |
concept | SomeYieldStopSource |
Specifies the interface for a stop token that internally uses a boost::asio::yield_context. | |
concept | SomeSimpleStopSource |
Specifies the interface for a simple stop token. | |
concept | SomeStopSource |
Specifies the interface for a stop source. | |
concept | SomeStopSourceProvider |
Specifies the interface for a provider of stop sources. | |
concept | SomeStoppableOutcome |
Specifies the interface for an outcome (promise) that can be stopped. | |
concept | SomeHandlerWithoutStopToken |
Specifies the interface for a handler that can be stopped. | |
concept | SomeHandlerWith |
Specifies the interface for a handler that can be invoked with the specified args. | |
concept | SomeStdDuration |
Specifies that the type must be some std::duration. | |
concept | SomeStdOptional |
Specifies that the type must be some std::optional. | |
concept | SomeOptStdDuration |
Specifies that the type must be some std::duration wrapped in an optional. | |
concept | NotSameAs |
Checks that decayed T s not of the same type as Erased. | |
concept | RValueNotSameAs |
Check that T is an r-value and is not the same type as Erased. | |
Typedefs | |
using | CoroExecutionContext |
A Boost.Coroutine-based (asio yield_context) execution context. | |
using | PoolExecutionContext |
A asio::thread_pool-based execution context. | |
using | SyncExecutionContext |
A synchronous execution context. Runs on the caller thread. | |
template<typename RetType > | |
using | Operation = impl::BasicOperation<Outcome<RetType>> |
The future side of async operations that cannot be stopped. | |
template<typename CtxType , typename OpType > | |
using | ScheduledOperation = impl::BasicScheduledOperation<CtxType, OpType> |
The future side of async operations that can be scheduled. | |
This namespace implements an async framework built on top of execution contexts.
There are multiple execution contexts available, each with its own set of features and trade-offs.
A Boost.Coroutine-based (asio yield_context) execution context.
This execution context uses asio::spawn
to create a coroutine per executed operation. The stop token that is sent to the lambda to execute is YieldContextStopSource::Token and is special in the way that each time your code checks token.isStopRequested()
the coroutine will be suspended and other work such as timers and/or other operations in the queue will get a chance to run. This makes it possible to have 1 thread in the execution context and still be able to execute operations AND timers at the same time.
using util::async::Operation = impl::BasicOperation<Outcome<RetType>> |
The future
side of async operations that cannot be stopped.
RetType | The return type of the operation |
A asio::thread_pool-based execution context.
This execution context uses asio::post
to dispatch operations to the thread pool. Please note that this execution context can't handle timers and operations at the same time iff you have exactly 1 thread in the thread pool.
using util::async::ScheduledOperation = impl::BasicScheduledOperation<CtxType, OpType> |
The future
side of async operations that can be scheduled.
CtxType | The type of the execution context |
OpType | The type of the wrapped operation |
A synchronous execution context. Runs on the caller thread.
This execution context runs the operations on the same thread that requested the operation to run. Each operation must finish before the corresponding execute
returns an operation object that can immediately be queried for value or error as it's guaranteed to have completed. Timer-based operations are scheduled via SystemExecutionContext, including those that are scheduled from within a strand.