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

A11's core wire value types: chunks, node fragments and messages. More...

#include <optional>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include <absl/base/nullability.h>
#include <absl/container/flat_hash_map.h>
#include <absl/status/status.h>
#include <absl/status/statusor.h>
#include <absl/time/time.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::data::ChunkMetadata
 Descriptive metadata attached to a a11::data::Chunk. More...
 
struct  a11::data::Chunk
 A unit of data: bytes plus optional descriptive metadata. More...
 
struct  a11::data::NodeRef
 A reference to a (slice of a) logical node, in lieu of inline data. More...
 
struct  a11::data::NodeFragment
 One piece of a node's stream: an inline chunk or a node reference. More...
 
struct  a11::data::Port
 Binds an action's port name to the concrete node id serving it. More...
 
struct  a11::data::ActionMessage
 The wire description of an action invocation. More...
 
struct  a11::data::WireMessage
 The top-level frame exchanged between two A11 endpoints. More...
 

Namespaces

namespace  a11
 
namespace  a11::data
 

Typedefs

using a11::data::Bytes = std::string
 Raw byte payload; an alias of std::string.
 
using a11::data::ByteMap = absl::flat_hash_map< std::string, Bytes >
 String-keyed map of byte values (headers, attributes, etc.).
 

Functions

absl::Status a11::data::ValidateName (std::string_view name)
 Validates an A11 identifier (node/port/action name).
 
bool a11::data::IsHalfCloseMessage (const WireMessage &message)
 Whether message is a transport half-close signal.
 
WireMessage a11::data::MakeHalfCloseMessage (ByteMap trailers={})
 Builds a half-close WireMessage carrying optional trailers.
 
size_t a11::data::EmptyWireMessageSize ()
 The encoded size of an empty WireMessage.
 

Detailed Description

A11's core wire value types: chunks, node fragments and messages.

These are the plain data records that A11 moves between endpoints. A a11::data::Chunk is a blob of bytes plus a a11::data::ChunkMetadata (mimetype and attributes); chunks flow through named nodes as a11::data::NodeFragment values (either an inline chunk or a a11::data::NodeRef pointing at a slice of another node). Actions are described on the wire by a11::data::ActionMessage (a named invocation with input/output a11::data::Port lists and headers), and one or more of these, together with node fragments, are batched into a a11::data::WireMessage – the unit exchanged across a stream.

Every record validates itself, reports an approximate encoded size, prints a debug string, and round-trips through MessagePack via ToMsgpack / FromMsgpack.