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

One piece of a node's stream: an inline chunk or a node reference. More...

#include <cpp/a11/data/types.h>

Public Member Functions

size_t ApproxBytes () const
 Estimate memory/wire weight for session and transport limits.
 
std::string DebugString () const
 Return a concise representation suitable for logs and diagnostics.
 
absl::Status Validate () const
 Validate the node id, payload, sequence, and continuation marker.
 
absl::StatusOr< Chunk *absl_nonnullGetChunk ()
 Returns the held Chunk, or an error when it holds a NodeRef.
 
absl::StatusOr< const Chunk *absl_nonnullGetChunk () const
 Returns the held Chunk, or an error when it holds a NodeRef.
 
absl::StatusOr< NodeRef *absl_nonnullGetNodeRef ()
 Returns the held NodeRef, or an error when it holds a Chunk.
 
absl::StatusOr< const NodeRef *absl_nonnullGetNodeRef () const
 Returns the held NodeRef, or an error when it holds a Chunk.
 
absl::StatusOr< BytesToMsgpack () const
 Encodes this fragment as MessagePack bytes.
 

Static Public Member Functions

static absl::StatusOr< NodeFragmentFromMsgpack (std::string_view bytes)
 Decodes MessagePack bytes into a NodeFragment.
 

Public Attributes

std::string id
 Id of the node this fragment belongs to.
 
std::variant< Chunk, NodeRefdata = Chunk{}
 Inline chunk or reference.
 
std::optional< std::uint32_t > seq
 Ordering sequence number.
 
bool continued = false
 Whether further fragments follow this one.
 

Friends

bool operator== (const NodeFragment &, const NodeFragment &)=default
 
template<typename Sink >
void AbslStringify (Sink &sink, const NodeFragment &value)
 

Detailed Description

One piece of a node's stream: an inline chunk or a node reference.

Fragments are how data flows through a named node. Each targets a node by id and carries either a Chunk or a NodeRef. seq orders fragments within the node and continued marks that more fragments follow (the stream is not yet complete).

Member Function Documentation

◆ ApproxBytes()

size_t a11::data::NodeFragment::ApproxBytes ( ) const

Estimate memory/wire weight for session and transport limits.

◆ DebugString()

std::string a11::data::NodeFragment::DebugString ( ) const

Return a concise representation suitable for logs and diagnostics.

◆ FromMsgpack()

absl::StatusOr< NodeFragment > a11::data::NodeFragment::FromMsgpack ( std::string_view  bytes)
static

Decodes MessagePack bytes into a NodeFragment.

◆ GetChunk() [1/2]

absl::StatusOr< Chunk *absl_nonnull > a11::data::NodeFragment::GetChunk ( )

Returns the held Chunk, or an error when it holds a NodeRef.

◆ GetChunk() [2/2]

absl::StatusOr< const Chunk *absl_nonnull > a11::data::NodeFragment::GetChunk ( ) const

Returns the held Chunk, or an error when it holds a NodeRef.

◆ GetNodeRef() [1/2]

absl::StatusOr< NodeRef *absl_nonnull > a11::data::NodeFragment::GetNodeRef ( )

Returns the held NodeRef, or an error when it holds a Chunk.

◆ GetNodeRef() [2/2]

absl::StatusOr< const NodeRef *absl_nonnull > a11::data::NodeFragment::GetNodeRef ( ) const

Returns the held NodeRef, or an error when it holds a Chunk.

◆ ToMsgpack()

absl::StatusOr< Bytes > a11::data::NodeFragment::ToMsgpack ( ) const

Encodes this fragment as MessagePack bytes.

◆ Validate()

absl::Status a11::data::NodeFragment::Validate ( ) const

Validate the node id, payload, sequence, and continuation marker.

Friends And Related Symbol Documentation

◆ AbslStringify

template<typename Sink >
void AbslStringify ( Sink sink,
const NodeFragment value 
)
friend

◆ operator==

bool operator== ( const NodeFragment ,
const NodeFragment  
)
friend

Member Data Documentation

◆ continued

bool a11::data::NodeFragment::continued = false

Whether further fragments follow this one.

◆ data

std::variant<Chunk, NodeRef> a11::data::NodeFragment::data = Chunk{}

Inline chunk or reference.

◆ id

std::string a11::data::NodeFragment::id

Id of the node this fragment belongs to.

◆ seq

std::optional<std::uint32_t> a11::data::NodeFragment::seq

Ordering sequence number.


The documentation for this struct was generated from the following files: