|
A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
|
A Session variant that buffers inbound messages for pull-style reception. More...
#include <cpp/a11/service/session.h>
Classes | |
| struct | ReceiveState |
Public Member Functions | |
| a11::Future< std::optional< ReceivedSessionMessage > > | ReceiveWithStreamId (absl::Time deadline=absl::InfiniteFuture()) |
| Await the next inbound message together with its stream id. | |
| a11::Future< std::optional< data::WireMessage > > | Receive (absl::Time deadline=absl::InfiniteFuture()) |
| Await the next inbound wire message. | |
| absl::Status | Abort (absl::Status status) override |
| Abort the session, also failing any pending receivers. | |
Public Member Functions inherited from a11::service::Session | |
| virtual | ~Session ()=default |
| absl::StatusOr< std::vector< std::pair< std::string, std::shared_ptr< net::WireStream > > > > | Streams () const |
| Return the streams currently attached to the session. | |
| absl::StatusOr< std::shared_ptr< net::WireStream > > | GetStream (std::string_view stream_id) const |
| Look up an attached stream by id. | |
| std::string | GetId () const |
| Return the session's unique identifier. | |
| std::shared_ptr< nodes::NodeMap > | GetNodeMap () const |
| Return the NodeMap backing this session's node state. | |
| absl::Status | SetNodeMap (std::shared_ptr< nodes::NodeMap > node_map) |
| Replace the NodeMap backing this session's node state. | |
| std::shared_ptr< actions::ActionRegistry > | GetActionRegistry () const |
| Return the registry used to resolve incoming action messages. | |
| absl::Status | SetActionRegistry (std::shared_ptr< actions::ActionRegistry > registry) |
| Replace the registry used to resolve incoming action messages. | |
| std::vector< std::pair< std::string, std::shared_ptr< actions::Action > > > | Actions () const |
| Return the actions currently running in the session. | |
| absl::StatusOr< std::shared_ptr< actions::Action > > | GetAction (std::string_view action_id) const |
| Look up a running action by id. | |
| absl::Status | CancelAction (std::string_view action_id) |
| Request cancellation of a running action. | |
| absl::Status | CancelAllActions () |
| Request cancellation of every running action. | |
| a11::Task | AwaitAllActions (absl::Duration timeout=absl::InfiniteDuration()) |
| Wait for all in-flight actions to finish. | |
| a11::Future< std::uint32_t > | DispatchNodeFragment (data::NodeFragment fragment) |
| Dispatch a node fragment into the session's NodeMap. | |
| a11::Task | DispatchActionMessage (data::ActionMessage message, std::shared_ptr< net::WireStream > origin_stream=nullptr) |
| Resolve an action message against the registry and run it. | |
| a11::Task | DispatchAction (std::shared_ptr< actions::Action > action) |
| Run an already-constructed action within the session. | |
| a11::Task | DispatchWireMessage (data::WireMessage message, std::shared_ptr< net::WireStream > origin_stream=nullptr) |
| Route a wire message through the session as if it arrived on a stream. | |
| bool | IsClosed () const |
| Report whether the session has been closed. | |
| bool | IsDone () const |
| Report whether the session has fully finished. | |
| a11::Task | Done () const |
| Await the session's full completion. | |
| absl::Status | GetStatus () const |
| Return the session's terminal status. | |
| absl::StatusOr< a11::Task > | AddStream (std::shared_ptr< net::WireStream > stream, StreamMode mode=StreamMode::kStart) |
| Attach a wire stream and begin pumping its messages. | |
| absl::Status | HalfClose () |
| Signal that this side will send no more messages. | |
| absl::Status | Send (data::WireMessage message, std::string_view stream_id={}) |
| Enqueue a wire message for delivery. | |
| absl::Time | deadline () const |
| Return the absolute deadline after which the session is aborted. | |
| absl::Status | SetDeadline (absl::Time deadline=absl::InfiniteFuture()) |
| Set the absolute deadline after which the session is aborted. | |
Static Public Member Functions | |
| static absl::StatusOr< std::shared_ptr< SessionWithRecv > > | Create (std::string session_id={}, data::ByteMap headers={}, SessionOptions options={}, std::shared_ptr< nodes::NodeMap > node_map=nullptr, std::shared_ptr< actions::ActionRegistry > action_registry=nullptr) |
| Create a pull-style session. | |
Static Public Member Functions inherited from a11::service::Session | |
| static absl::StatusOr< std::shared_ptr< Session > > | Create (std::string session_id={}, OnSessionStreamMessage on_stream_message={}, OnSessionStreamDone on_stream_done={}, data::ByteMap headers={}, SessionOptions options={}, std::shared_ptr< nodes::NodeMap > node_map=nullptr, std::shared_ptr< actions::ActionRegistry > action_registry=nullptr) |
| Create a session. | |
Additional Inherited Members | |
Protected Member Functions inherited from a11::service::Session | |
| Session ()=default | |
| absl::Status | Initialize (const std::shared_ptr< Session > &self, std::string session_id, OnSessionStreamMessage on_stream_message, OnSessionStreamDone on_stream_done, data::ByteMap headers, SessionOptions options, std::shared_ptr< nodes::NodeMap > node_map, std::shared_ptr< actions::ActionRegistry > action_registry) |
A Session variant that buffers inbound messages for pull-style reception.
Instead of delivering messages through callbacks, this session buffers them so the caller can await them explicitly via Receive() / ReceiveWithStreamId(). Suits agents that consume messages in their own loop.
|
overridevirtual |
Abort the session, also failing any pending receivers.
| status | The error to abort with. |
Reimplemented from a11::service::Session.
|
static |
Create a pull-style session.
| session_id | Unique identifier; generated when empty. |
| headers | Session-level headers. |
| options | Limits and timeouts governing the session. |
| node_map | Node registry backing the session; a fresh one is created when null. |
| action_registry | Registry resolving incoming action messages; may be null. |
| a11::Future< std::optional< data::WireMessage > > a11::service::SessionWithRecv::Receive | ( | absl::Time | deadline = absl::InfiniteFuture() | ) |
Await the next inbound wire message.
| deadline | Absolute time to stop waiting. |
| a11::Future< std::optional< ReceivedSessionMessage > > a11::service::SessionWithRecv::ReceiveWithStreamId | ( | absl::Time | deadline = absl::InfiniteFuture() | ) |
Await the next inbound message together with its stream id.
| deadline | Absolute time to stop waiting. |