A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
session.h File Reference

A11's connection-scoped runtime: the Session. More...

#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <absl/status/status.h>
#include <absl/status/statusor.h>
#include <absl/time/time.h>
#include "a11/actions/action.h"
#include "a11/actions/registry.h"
#include "a11/concurrency/future.h"
#include "a11/data/types.h"
#include "a11/net/wire_stream.h"
#include "a11/nodes/node_map.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::service::SessionOptions
 Limits and timeouts governing a Session's buffering, concurrency, and lifetime. More...
 
class  a11::service::Session
 A connection-scoped runtime that multiplexes wire streams and runs actions. More...
 
struct  a11::service::ReceivedSessionMessage
 An inbound wire message paired with the id of the stream it arrived on. More...
 
class  a11::service::SessionWithRecv
 A Session variant that buffers inbound messages for pull-style reception. More...
 

Namespaces

namespace  a11
 
namespace  a11::service
 

Typedefs

using a11::service::OnSessionStreamMessage = std::function< a11::Task(std::optional< data::WireMessage >, std::shared_ptr< net::WireStream >, std::shared_ptr< Session >)>
 Callback invoked for each message received on a session stream (nullopt signals end-of-stream); may be a coroutine.
 
using a11::service::OnSessionStreamDone = std::function< a11::Task(std::shared_ptr< net::WireStream >, std::shared_ptr< Session >)>
 Callback invoked once a session stream has finished; may be a coroutine.
 

Enumerations

enum class  a11::service::StreamMode { a11::service::kStart , a11::service::kAccept }
 Whether this side starts (kStart) or accepts (kAccept) a stream during its startup handshake. More...
 

Functions

absl::StatusOr< data::ByteMapa11::service::NormalizeSessionHeaders (data::ByteMap headers)
 Validate and case-normalize session headers.
 

Variables

constexpr std::string_view a11::service::kSessionStatusHeader = "x-a11-session-status"
 Trailer/header used to communicate the session's structured terminal status.
 
constexpr size_t a11::service::kMaxSingleMessageSize = 32 * 1024 * 1024
 Hard upper bound for any one WireMessage admitted by a Session.
 

Detailed Description

A11's connection-scoped runtime: the Session.

A Session multiplexes one or more net::WireStream transports, dispatches incoming actions::Action calls against an actions::ActionRegistry, and tracks their lifetimes so the connection can drain and close cleanly. It is the top-level object an agent drives – server or client – to exchange wire messages and run actions; node fragments it receives are applied to a nodes::NodeMap.

This header also declares SessionOptions (the session's limits and timeouts) and SessionWithRecv, a variant that buffers inbound messages for pull-style Receive() consumption instead of callbacks.