A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
a11::actions Namespace Reference

Classes

class  Action
 A11's unit of work: a schema-described, asynchronously run operation. More...
 
struct  ActionHeaderSchema
 Schema for a single header an action accepts. More...
 
class  ActionLimiter
 Cancellation-aware counting semaphore for nested-action concurrency. More...
 
struct  ActionPortSchema
 Schema for a single input or output port of an action. More...
 
class  ActionRegistry
 A thread-safe catalogue mapping action names to schema and handler. More...
 
struct  ActionSchema
 The full typed interface of an action. More...
 
struct  ActionSettings
 Per-action runtime settings for stream binding and cleanup. More...
 

Typedefs

using ActionHandler = std::function< a11::Task(std::shared_ptr< Action >)>
 Asynchronous action handler: runs the action, returns an awaitable.
 
using SyncActionHandler = std::function< absl::Status(std::shared_ptr< Action >)>
 Synchronous action handler returning a completion status.
 
using OnActionCancelled = std::function< absl::Status(std::shared_ptr< Action >)>
 Callback invoked when an action is cancelled.
 

Functions

ActionHandler MakeAsyncActionHandler (SyncActionHandler handler)
 Adapts a synchronous handler into an asynchronous ActionHandler.
 
absl::StatusOr< data::ChunkStatusToChunk (const absl::Status &status)
 Encodes a status as a chunk (mimetype kActionStatusMimetype).
 
absl::StatusOr< absl::Status > StatusFromChunk (const data::Chunk &chunk)
 Decodes a status previously encoded by StatusToChunk.
 
bool IsStatusChunk (const data::Chunk &chunk)
 Whether chunk carries an encoded action status.
 

Variables

constexpr size_t kDefaultMaxConcurrentNestedActions = 64
 Default cap on concurrently running nested actions.
 
constexpr std::string_view kActionStatusMimetype
 Mimetype marking a chunk that carries an action status.
 
constexpr std::string_view kActionStatusOutput = "__status__"
 Reserved output port name carrying the action's completion status.
 
constexpr std::string_view kActionDispatchStatusOutput
 Reserved output port name carrying the remote dispatch status.
 
constexpr std::string_view kCancelActionName = "__cancel__"
 Reserved action name used to signal cancellation to a peer.
 
constexpr std::string_view kCancelActionHeader = "__action"
 Header naming the action targeted by a cancel request.
 
constexpr std::string_view kActionHeaderPrefix = "x-a11-"
 Prefix reserved for A11's framework headers.
 

Typedef Documentation

◆ ActionHandler

using a11::actions::ActionHandler = typedef std::function<a11::Task(std::shared_ptr<Action>)>

Asynchronous action handler: runs the action, returns an awaitable.

◆ OnActionCancelled

using a11::actions::OnActionCancelled = typedef std::function<absl::Status(std::shared_ptr<Action>)>

Callback invoked when an action is cancelled.

◆ SyncActionHandler

using a11::actions::SyncActionHandler = typedef std::function<absl::Status(std::shared_ptr<Action>)>

Synchronous action handler returning a completion status.

Function Documentation

◆ IsStatusChunk()

bool a11::actions::IsStatusChunk ( const data::Chunk chunk)

Whether chunk carries an encoded action status.

◆ MakeAsyncActionHandler()

ActionHandler a11::actions::MakeAsyncActionHandler ( SyncActionHandler  handler)

Adapts a synchronous handler into an asynchronous ActionHandler.

◆ StatusFromChunk()

absl::StatusOr< absl::Status > a11::actions::StatusFromChunk ( const data::Chunk chunk)

Decodes a status previously encoded by StatusToChunk.

◆ StatusToChunk()

absl::StatusOr< data::Chunk > a11::actions::StatusToChunk ( const absl::Status &  status)

Encodes a status as a chunk (mimetype kActionStatusMimetype).

Variable Documentation

◆ kActionDispatchStatusOutput

constexpr std::string_view a11::actions::kActionDispatchStatusOutput
inlineconstexpr
Initial value:
=
"__dispatch_status__"

Reserved output port name carrying the remote dispatch status.

◆ kActionHeaderPrefix

constexpr std::string_view a11::actions::kActionHeaderPrefix = "x-a11-"
inlineconstexpr

Prefix reserved for A11's framework headers.

◆ kActionStatusMimetype

constexpr std::string_view a11::actions::kActionStatusMimetype
inlineconstexpr
Initial value:
=
"application/x-a11-status"

Mimetype marking a chunk that carries an action status.

◆ kActionStatusOutput

constexpr std::string_view a11::actions::kActionStatusOutput = "__status__"
inlineconstexpr

Reserved output port name carrying the action's completion status.

◆ kCancelActionHeader

constexpr std::string_view a11::actions::kCancelActionHeader = "__action"
inlineconstexpr

Header naming the action targeted by a cancel request.

◆ kCancelActionName

constexpr std::string_view a11::actions::kCancelActionName = "__cancel__"
inlineconstexpr

Reserved action name used to signal cancellation to a peer.

◆ kDefaultMaxConcurrentNestedActions

constexpr size_t a11::actions::kDefaultMaxConcurrentNestedActions = 64
inlineconstexpr

Default cap on concurrently running nested actions.