A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::data::TypedChunkObject< T > Class Template Referencefinal

The local fast path: a value in a chunk, encoded only if needed. More...

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

Inheritance diagram for a11::data::TypedChunkObject< T >:
[legend]

Public Member Functions

 TypedChunkObject (T value, std::string tag, std::string mimetype, std::shared_ptr< const SerializationRegistry > registry)
 
std::string_view tag () const override
 The serialisation tag of the held type.
 
std::string_view mimetype () const override
 The mimetype the value would be encoded as.
 
const void *absl_nonnull address () const override
 The address of the held value.
 
absl::StatusOr< Bytes > Encode () const override
 Encodes the value, for whoever needs bytes after all.
 
size_t ApproxBytes () const override
 A size estimate that does not encode anything.
 
- Public Member Functions inherited from a11::data::ChunkObject
virtual ~ChunkObject ()=default
 

Detailed Description

template<typename T>
class a11::data::TypedChunkObject< T >

The local fast path: a value in a chunk, encoded only if needed.

MakeChunkObject() builds the chunk a producer puts on a node – with the value attached and no bytes – and TryTakeObject() is how a consumer in the same process gets the value back without either side encoding anything. A consumer elsewhere, or a store that persists, calls Chunk::Materialize() and gets exactly the bytes it always got.

The pair is templated in the caller's translation unit, which is what makes it safe: the value's type is known at both ends, and what crosses between them is a tag comparison rather than a type identity. See a11::data::ChunkObject.

Constructor & Destructor Documentation

◆ TypedChunkObject()

template<typename T >
a11::data::TypedChunkObject< T >::TypedChunkObject ( T  value,
std::string  tag,
std::string  mimetype,
std::shared_ptr< const SerializationRegistry >  registry 
)
inline

Member Function Documentation

◆ address()

template<typename T >
const void *absl_nonnull a11::data::TypedChunkObject< T >::address ( ) const
inlineoverridevirtual

The address of the held value.

Do not call this. It is dereferenced in exactly one place – a11::data::TryTakeObject, which compares tag() first – and a cast without that comparison is undefined behaviour with a plausible-looking result.

Implements a11::data::ChunkObject.

◆ ApproxBytes()

template<typename T >
size_t a11::data::TypedChunkObject< T >::ApproxBytes ( ) const
inlineoverridevirtual

A size estimate that does not encode anything.

Implements a11::data::ChunkObject.

◆ Encode()

template<typename T >
absl::StatusOr< Bytes > a11::data::TypedChunkObject< T >::Encode ( ) const
overridevirtual

Encodes the value, for whoever needs bytes after all.

Implements a11::data::ChunkObject.

◆ mimetype()

template<typename T >
std::string_view a11::data::TypedChunkObject< T >::mimetype ( ) const
inlineoverridevirtual

The mimetype the value would be encoded as.

Implements a11::data::ChunkObject.

◆ tag()

template<typename T >
std::string_view a11::data::TypedChunkObject< T >::tag ( ) const
inlineoverridevirtual

The serialisation tag of the held type.

Implements a11::data::ChunkObject.


The documentation for this class was generated from the following file: