|
A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
|
A bidirectional, message-oriented channel between two A11 endpoints. More...
#include <a11/net/wire_stream.h>
Public Member Functions | |
| virtual | ~WireStream ()=default |
| virtual absl::Status | Send (data::WireMessage message)=0 |
| Enqueue a message for delivery to the peer. | |
| virtual a11::Task | Start (OnMessage on_message, OnDone on_done)=0 |
| Begin the stream as the initiating ("start") side. | |
| virtual a11::Task | Accept (OnMessage on_message, OnDone on_done)=0 |
| Begin the stream as the accepting ("accept") side. | |
| 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. | |
| virtual a11::Task | DrainOutgoingMessages ()=0 |
| Await delivery of all buffered outbound messages. | |
| virtual absl::Status | Abort (absl::Status status)=0 |
| Abort the stream, discarding buffered work. | |
| 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. | |
| virtual absl::Time | deadline () const =0 |
| virtual absl::Status | GetStatus () const =0 |
| virtual std::optional< data::ByteMap > | GetTrailers () const =0 |
| virtual std::string | GetId () const =0 |
| virtual void *absl_nullable | GetImpl () const =0 |
A bidirectional, message-oriented channel between two A11 endpoints.
A WireStream is A11's transport abstraction: an ordered neither – delivery carries no global ordering guarantee. Messages may be observed by the reader in an order different from how the sender enqueued them, and different transports (e.g. an unreliable WebRTC data channel) make that explicit. The one synchronisation point the interface does promise is closure: every message accepted for delivery is observed by the reader before the stream reports done, and the half-close marker follows messages already queued by that endpoint. HalfClose() queues that transition; DrainOutgoingMessages() is the explicit local delivery barrier. Callers that need ordering must impose it above the transport (an AsyncNode/ChunkStore log, which is ordered by sequence number, is the usual way).
Implement this interface to carry A11 traffic over a transport A11 does not ship; the runtime treats every implementation identically.
|
virtualdefault |
|
pure virtual |
Abort the stream, discarding buffered work.
| status | A non-OK status reported to the peer as the abort reason. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
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. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
Await delivery of all buffered outbound messages.
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
inline |
Half-close with no trailers.
|
pure 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. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, a11::net::WireStreamWithRecv, a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
pure virtual |
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. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
|
inline |
Clear any deadline (equivalent to an infinite deadline).
|
pure virtual |
Set the absolute deadline after which the stream is aborted.
| deadline | The deadline; absl::InfiniteFuture() disables it. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, a11::net::WireStreamWithRecv, a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.
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. |
Implemented in a11::net::ChannelWireStream, a11::net::HttpSseWireStream, a11::net::InProcessWireStream, and a11::net::WireStreamWithRecv.