3#ifndef A11_NET_CHANNEL_WIRE_STREAM_H_
4#define A11_NET_CHANNEL_WIRE_STREAM_H_
12#include <absl/base/nullability.h>
13#include <absl/status/status.h>
14#include <absl/status/statusor.h>
15#include <absl/time/time.h>
55 public std::enable_shared_from_this<ChannelWireStream> {
70 absl::Status
Abort(absl::Status status)
override;
83 : state_(std::
move(state)) {}
85 static absl::StatusOr<std::shared_ptr<State>>
MakeState(
86 std::shared_ptr<internal::BinaryChannel> channel, std::string
id,
92 static void Sender(std::shared_ptr<State> state);
93 static void Receiver(std::shared_ptr<State> state);
94 static void WatchTiming(std::shared_ptr<State> state);
95 static void MarkActivity(
const std::shared_ptr<State>& state);
96 static void ForceAbort(
const std::shared_ptr<State>& state,
98 static void MaybeFinish(
const std::shared_ptr<State>& state);
99 static void Finish(
const std::shared_ptr<State>& state,
101 static void Notify(
const std::shared_ptr<State>& state);
103 std::shared_ptr<State> state_;
Bounded packetisation and reassembly for binary channel transports.
Shared WireStream lifecycle and framing for binary channels.
Definition channel_wire_stream.h:55
std::optional< data::ByteMap > GetTrailers() const override
Definition channel_wire_stream.cc:513
ChannelWireStream(std::shared_ptr< State > state)
Definition channel_wire_stream.h:82
absl::Status GetStatus() const override
Definition channel_wire_stream.cc:498
absl::Status Abort(absl::Status status) override
Abort the stream, discarding buffered work.
Definition channel_wire_stream.cc:459
a11::Task Start(OnMessage on_message, OnDone on_done) override
Begin the stream as the initiating ("start") side.
Definition channel_wire_stream.cc:238
std::function< absl::Status()> OpenOperation
Transport-specific operation that initiates or accepts the channel.
Definition channel_wire_stream.h:58
absl::Status SetDeadline()
Clear any deadline (equivalent to an infinite deadline).
Definition wire_stream.h:154
absl::Status HalfClose()
Half-close with no trailers.
Definition wire_stream.h:125
~ChannelWireStream() override
Definition channel_wire_stream.cc:162
a11::Task DrainOutgoingMessages() override
Await delivery of all buffered outbound messages.
Definition channel_wire_stream.cc:447
std::string GetId() const override
Definition channel_wire_stream.cc:518
absl::Status Send(data::WireMessage message) override
Enqueue a message for delivery to the peer.
Definition channel_wire_stream.cc:177
void *absl_nullable GetImpl() const override
Definition channel_wire_stream.cc:523
a11::Task Accept(OnMessage on_message, OnDone on_done) override
Begin the stream as the accepting ("accept") side.
Definition channel_wire_stream.cc:242
absl::Time deadline() const override
Definition channel_wire_stream.cc:493
static absl::StatusOr< std::shared_ptr< State > > MakeState(std::shared_ptr< internal::BinaryChannel > channel, std::string id, ChannelEndpointRole role, OpenOperation open_operation, WireStreamOptions options, ChannelFramingOptions framing={})
Definition channel_wire_stream.cc:135
A bidirectional, message-oriented channel between two A11 endpoints.
Definition wire_stream.h:89
absl::Status SetDeadline()
Clear any deadline (equivalent to an infinite deadline).
Definition wire_stream.h:154
absl::Status HalfClose()
Half-close with no trailers.
Definition wire_stream.h:125
Completion values used by every asynchronous A11 operation.
absl::flat_hash_map< std::string, Bytes > ByteMap
String-keyed map of byte values (headers, attributes, etc.).
Definition types.h:42
std::function< a11::Task(std::optional< data::WireMessage > message)> OnMessage
Called for each inbound message; std::nullopt signals the peer half-closed.
Definition wire_stream.h:65
std::function< a11::Task()> OnDone
Called once, when the stream has fully finished (cleanly or via abort).
Definition wire_stream.h:67
ChannelEndpointRole
Handshake role a binary channel endpoint is permitted to assume.
Definition channel_wire_stream.h:29
Future< T > SubmitWithCancellationHook(absl::AnyInvocable< absl::StatusOr< T >() && > work, std::function< void()> cancellation_hook, thread::TreeOptions tree_options)
Run work on A11's fiber pool with application-specific cancellation.
Definition executor.h:30
The top-level frame exchanged between two A11 endpoints.
Definition types.h:275
Packetisation and incomplete-message bounds for a binary WireStream.
Definition channel_wire_stream.h:32
size_t max_pending_bytes
Pending inbound byte limit.
Definition channel_wire_stream.h:38
size_t max_pending_messages
Incomplete inbound message limit.
Definition channel_wire_stream.h:37
size_t split_size
Maximum encoded channel packet size.
Definition channel_wire_stream.h:36
absl::Status Validate() const
Validate the framing limits before a transport starts.
Definition channel_wire_stream.cc:122
Definition channel_wire_stream.cc:48
Buffering, sizing, and deadline limits for a WireStream endpoint.
Definition wire_stream.h:44
A11's core wire value types: chunks, node fragments and messages.
A11's transport abstraction: the bidirectional WireStream channel and the options/callbacks that driv...