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

A unit of data: bytes plus optional descriptive metadata. More...

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

Public Member Functions

size_t ApproxBytes () const
 Estimate memory/wire weight for bounded-buffer accounting.
 
std::string DebugString () const
 Return a concise representation suitable for logs and diagnostics.
 
std::string GetMimetype () const
 Returns the metadata mimetype, or empty when unset.
 
bool IsEmpty () const
 Whether the chunk carries neither data nor a reference.
 
bool IsNull () const
 Whether the chunk represents an explicit null value.
 
absl::Status Validate () const
 Validate that payload, reference, and metadata fields are consistent.
 
absl::StatusOr< BytesToMsgpack () const
 Encodes this chunk as MessagePack bytes.
 

Static Public Member Functions

static absl::StatusOr< ChunkFromMsgpack (std::string_view bytes)
 Decodes MessagePack bytes into a Chunk.
 

Public Attributes

std::optional< ChunkMetadatametadata {}
 Optional payload metadata.
 
std::string ref {}
 Node id this chunk references, if not inline.
 
Bytes data {}
 Inline byte payload.
 

Friends

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

Detailed Description

A unit of data: bytes plus optional descriptive metadata.

A chunk holds its payload in data with an optional metadata describing it. Instead of inline data a chunk may instead carry a ref naming another node whose content it stands in for; such a reference must be resolved before the payload is used.

Member Function Documentation

◆ ApproxBytes()

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

Estimate memory/wire weight for bounded-buffer accounting.

◆ DebugString()

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

Return a concise representation suitable for logs and diagnostics.

◆ FromMsgpack()

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

Decodes MessagePack bytes into a Chunk.

◆ GetMimetype()

std::string a11::data::Chunk::GetMimetype ( ) const

Returns the metadata mimetype, or empty when unset.

◆ IsEmpty()

bool a11::data::Chunk::IsEmpty ( ) const

Whether the chunk carries neither data nor a reference.

◆ IsNull()

bool a11::data::Chunk::IsNull ( ) const

Whether the chunk represents an explicit null value.

◆ ToMsgpack()

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

Encodes this chunk as MessagePack bytes.

◆ Validate()

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

Validate that payload, reference, and metadata fields are consistent.

Friends And Related Symbol Documentation

◆ AbslStringify

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

◆ operator==

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

Member Data Documentation

◆ data

Bytes a11::data::Chunk::data {}

Inline byte payload.

◆ metadata

std::optional<ChunkMetadata> a11::data::Chunk::metadata {}

Optional payload metadata.

◆ ref

std::string a11::data::Chunk::ref {}

Node id this chunk references, if not inline.


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