A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
a11::data Namespace Reference

Classes

struct  ActionMessage
 The wire description of an action invocation. More...
 
struct  Chunk
 A unit of data: bytes plus optional descriptive metadata. More...
 
struct  ChunkMetadata
 Descriptive metadata attached to a a11::data::Chunk. More...
 
class  MsgpackReader
 Sequentially decode the fields of one A11 MessagePack wire record. More...
 
class  MsgpackWriter
 Incrementally encode the fields of one A11 wire record. More...
 
struct  NodeFragment
 One piece of a node's stream: an inline chunk or a node reference. More...
 
struct  NodeRef
 A reference to a (slice of a) logical node, in lieu of inline data. More...
 
struct  Port
 Binds an action's port name to the concrete node id serving it. More...
 
class  SerializationRegistry
 A registry of serializers and deserializers indexed by type and MIME. More...
 
struct  WireMessage
 The top-level frame exchanged between two A11 endpoints. More...
 

Typedefs

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

Functions

absl::StatusOr< JsonWireMessageToJsonValue (const WireMessage &message)
 
absl::StatusOr< std::string > WireMessageToJson (const WireMessage &message)
 
absl::StatusOr< WireMessageWireMessageFromJsonValue (const Json &value)
 
absl::StatusOr< WireMessageWireMessageFromJson (std::string_view encoded)
 
absl::StatusOr< WireMessageWireMessageFromJsonValue (const nlohmann::json &value)
 
nlohmann::json Binary (std::string_view bytes)
 Wrap arbitrary bytes as a MessagePack binary JSON value.
 
absl::StatusOr< std::string > GetBinary (const nlohmann::json &value, std::string_view field_name)
 Read a binary JSON value, naming field_name in any validation error.
 
absl::StatusOr< std::string > PackStatus (const absl::Status &status)
 Encode a structured Abseil status for action and transport status fields.
 
absl::StatusOr< absl::Status > UnpackStatus (std::string_view bytes)
 Decode a structured status without losing A11 status details.
 
SerializationRegistryGlobalSerializationRegistry ()
 Returns the process-wide registry (defaults pre-installed).
 
absl::Status ValidateName (std::string_view name)
 Validates an A11 identifier (node/port/action name).
 
bool IsHalfCloseMessage (const WireMessage &message)
 Whether message is a transport half-close signal.
 
WireMessage MakeHalfCloseMessage (ByteMap trailers={})
 Builds a half-close WireMessage carrying optional trailers.
 
size_t EmptyWireMessageSize ()
 The encoded size of an empty WireMessage.
 

Variables

constexpr std::string_view kJsonMimetype = "application/json"
 Media type of the built-in JSON codec.
 
constexpr std::string_view kMsgpackMimetype = "application/x-msgpack"
 Media type of the built-in MessagePack codec.
 

Typedef Documentation

◆ ByteMap

using a11::data::ByteMap = typedef absl::flat_hash_map<std::string, Bytes>

String-keyed map of byte values (headers, attributes, etc.).

◆ Bytes

Raw byte payload; an alias of std::string.

Function Documentation

◆ Binary()

nlohmann::json a11::data::Binary ( std::string_view  bytes)

Wrap arbitrary bytes as a MessagePack binary JSON value.

◆ EmptyWireMessageSize()

size_t a11::data::EmptyWireMessageSize ( )

The encoded size of an empty WireMessage.

Computed from the same encoder rather than hard-coded, so it stays correct if the wire format changes.

◆ GetBinary()

absl::StatusOr< std::string > a11::data::GetBinary ( const nlohmann::json &  value,
std::string_view  field_name 
)

Read a binary JSON value, naming field_name in any validation error.

◆ GlobalSerializationRegistry()

SerializationRegistry & a11::data::GlobalSerializationRegistry ( )

Returns the process-wide registry (defaults pre-installed).

◆ IsHalfCloseMessage()

bool a11::data::IsHalfCloseMessage ( const WireMessage message)

Whether message is a transport half-close signal.

◆ MakeHalfCloseMessage()

WireMessage a11::data::MakeHalfCloseMessage ( ByteMap  trailers)

Builds a half-close WireMessage carrying optional trailers.

◆ PackStatus()

absl::StatusOr< std::string > a11::data::PackStatus ( const absl::Status &  status)

Encode a structured Abseil status for action and transport status fields.

◆ UnpackStatus()

absl::StatusOr< absl::Status > a11::data::UnpackStatus ( std::string_view  bytes)

Decode a structured status without losing A11 status details.

◆ ValidateName()

absl::Status a11::data::ValidateName ( std::string_view  name)

Validates an A11 identifier (node/port/action name).

Parameters
nameCandidate name.
Returns
OK when name matches A11's identifier grammar, else an error.

◆ WireMessageFromJson()

absl::StatusOr< WireMessage > a11::data::WireMessageFromJson ( std::string_view  encoded)

◆ WireMessageFromJsonValue() [1/2]

absl::StatusOr< WireMessage > a11::data::WireMessageFromJsonValue ( const Json value)

◆ WireMessageFromJsonValue() [2/2]

absl::StatusOr< WireMessage > a11::data::WireMessageFromJsonValue ( const nlohmann::json &  value)

◆ WireMessageToJson()

absl::StatusOr< std::string > a11::data::WireMessageToJson ( const WireMessage message)

◆ WireMessageToJsonValue()

absl::StatusOr< nlohmann::json > a11::data::WireMessageToJsonValue ( const WireMessage message)

Variable Documentation

◆ kJsonMimetype

constexpr std::string_view a11::data::kJsonMimetype = "application/json"
inlineconstexpr

Media type of the built-in JSON codec.

◆ kMsgpackMimetype

constexpr std::string_view a11::data::kMsgpackMimetype = "application/x-msgpack"
inlineconstexpr

Media type of the built-in MessagePack codec.