|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
The local fast path: a value in a chunk, encoded only if needed. More...
#include <cpp/a11/data/serialization.h>
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 |
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.
|
inline |
|
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.
|
inlineoverridevirtual |
A size estimate that does not encode anything.
Implements a11::data::ChunkObject.
|
overridevirtual |
Encodes the value, for whoever needs bytes after all.
Implements a11::data::ChunkObject.
|
inlineoverridevirtual |
The mimetype the value would be encoded as.
Implements a11::data::ChunkObject.
|
inlineoverridevirtual |
The serialisation tag of the held type.
Implements a11::data::ChunkObject.