|
A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
|
Pull-oriented adapter for a callback-driven WireStream. More...
#include <cpp/a11/net/wire_stream_with_recv.h>
Classes | |
| struct | State |
Public Member Functions | |
| absl::Status | Send (data::WireMessage message) override |
| Enqueue a message for delivery to the peer. | |
| a11::Task | Start (OnMessage on_message, OnDone on_done) override |
| Begin the stream as the initiating ("start") side. | |
| a11::Task | Accept (OnMessage on_message, OnDone on_done) override |
| Begin the stream as the accepting ("accept") side. | |
| a11::Task | Start () |
| Start the wrapped stream and route inbound messages to Receive(). | |
| a11::Task | Accept () |
| Accept the wrapped stream and route inbound messages to Receive(). | |
| absl::Status | HalfClose (data::ByteMap trailers) override |
| Signal that this side will send no more messages. | |
| a11::Task | DrainOutgoingMessages () override |
| Await delivery of all buffered outbound messages. | |
| absl::Status | Abort (absl::Status status) override |
| Abort the stream, discarding buffered work. | |
| absl::Status | SetDeadline (absl::Time deadline) override |
| Set the absolute deadline after which the stream is aborted. | |
| absl::Time | deadline () const override |
| absl::Status | GetStatus () const override |
| std::optional< data::ByteMap > | GetTrailers () const override |
| std::string | GetId () const override |
| void *absl_nullable | GetImpl () const override |
| a11::Future< std::optional< data::WireMessage > > | Receive (absl::Duration timeout=absl::InfiniteDuration()) |
| Await one inbound message, or nullopt after the peer half-closes. | |
| std::shared_ptr< WireStream > | wrapped_stream () const |
| Return the underlying callback-oriented stream. | |
| WireStreamWithRecv (ConstructorToken, std::shared_ptr< WireStream > stream, std::string id, std::shared_ptr< State > state) | |
| absl::Status | HalfClose () |
| Half-close with no trailers. | |
| virtual absl::Status | HalfClose (data::ByteMap trailers)=0 |
| Signal that this side will send no more messages. | |
| absl::Status | SetDeadline () |
| Clear any deadline (equivalent to an infinite deadline). | |
| virtual absl::Status | SetDeadline (absl::Time deadline)=0 |
| Set the absolute deadline after which the stream is aborted. | |
Public Member Functions inherited from a11::net::WireStream | |
| virtual | ~WireStream ()=default |
| absl::Status | HalfClose () |
| Half-close with no trailers. | |
| absl::Status | SetDeadline () |
| Clear any deadline (equivalent to an infinite deadline). | |
Static Public Member Functions | |
| static absl::StatusOr< std::shared_ptr< WireStreamWithRecv > > | Create (std::shared_ptr< WireStream > stream) |
Wrap stream, preserving its id, lifecycle, and transport handle. | |
Pull-oriented adapter for a callback-driven WireStream.
Wrap a stream when an agent loop would rather await Receive() than implement callbacks. Its single message slot preserves transport backpressure. A remote abort takes priority over buffered data and is observed by every current and future receiver.
|
inline |
|
overridevirtual |
Abort the stream, discarding buffered work.
| status | A non-OK status reported to the peer as the abort reason. |
Implements a11::net::WireStream.
| a11::Task a11::net::WireStreamWithRecv::Accept | ( | ) |
Accept the wrapped stream and route inbound messages to Receive().
|
overridevirtual |
Begin the stream as the accepting ("accept") side.
| on_message | Invoked for each inbound message (nullopt = peer half-closed). |
| on_done | Invoked once when the stream has finished. |
Implements a11::net::WireStream.
|
static |
Wrap stream, preserving its id, lifecycle, and transport handle.
|
overridevirtual |
Implements a11::net::WireStream.
|
overridevirtual |
Await delivery of all buffered outbound messages.
Implements a11::net::WireStream.
|
overridevirtual |
Implements a11::net::WireStream.
|
overridevirtual |
Implements a11::net::WireStream.
|
overridevirtual |
Implements a11::net::WireStream.
|
overridevirtual |
Implements a11::net::WireStream.
|
inline |
Half-close with no trailers.
|
overridevirtual |
Signal that this side will send no more messages.
The terminal marker is queued after buffered outbound messages and, once the peer also half-closes, the stream completes. Inbound messages continue to be delivered until then. Call DrainOutgoingMessages() to await local transport delivery.
| trailers | Optional closing metadata delivered to the peer. |
Implements a11::net::WireStream.
|
virtual |
Signal that this side will send no more messages.
The terminal marker is queued after buffered outbound messages and, once the peer also half-closes, the stream completes. Inbound messages continue to be delivered until then. Call DrainOutgoingMessages() to await local transport delivery.
| trailers | Optional closing metadata delivered to the peer. |
Implements a11::net::WireStream.
| a11::Future< std::optional< data::WireMessage > > a11::net::WireStreamWithRecv::Receive | ( | absl::Duration | timeout = absl::InfiniteDuration() | ) |
Await one inbound message, or nullopt after the peer half-closes.
| timeout | Maximum duration to wait for the next lifecycle event. |
|
overridevirtual |
Enqueue a message for delivery to the peer.
Non-blocking.
The message is admitted to this endpoint's outbound queue and delivered asynchronously by the transport task, which is also where backpressure is applied; there is no delivery-order guarantee across messages (see the class comment).
| message | The message to send. |
Implements a11::net::WireStream.
|
inline |
Clear any deadline (equivalent to an infinite deadline).
|
overridevirtual |
Set the absolute deadline after which the stream is aborted.
| deadline | The deadline; absl::InfiniteFuture() disables it. |
Implements a11::net::WireStream.
|
virtual |
Set the absolute deadline after which the stream is aborted.
| deadline | The deadline; absl::InfiniteFuture() disables it. |
Implements a11::net::WireStream.
| a11::Task a11::net::WireStreamWithRecv::Start | ( | ) |
Start the wrapped stream and route inbound messages to Receive().
|
overridevirtual |
Begin the stream as the initiating ("start") side.
| on_message | Invoked for each inbound message (nullopt = peer half-closed). |
| on_done | Invoked once when the stream has finished. |
Implements a11::net::WireStream.
|
inline |
Return the underlying callback-oriented stream.