A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::flow::HostBridge Class Referenceabstract

What the process running a flow knows and the language does not. More...

#include <cpp/a11/flow/values.h>

Public Member Functions

virtual ~HostBridge ()=default
 
virtual absl::StatusOr< Value > Coerce (std::string_view tag, const Value &value)=0
 Make value a value of the type tag names.
 
virtual absl::StatusOr< Value > FromChunk (const data::Chunk &chunk)=0
 The value chunk holds.
 
virtual absl::StatusOr< data::Chunk > ToChunk (const Value &value, std::string_view mimetype)=0
 A chunk holding value, in mimetype when one is asked for.
 
virtual bool CanPassChunkObject (const data::Chunk &chunk, std::string_view declared_type) const
 Whether a typed port can retain this local object without conversion.
 
virtual std::vector< absl::StatusOr< Value > > FromChunks (absl::Span< const data::Chunk *const > chunks)
 Reads a batch in order, retaining a separate result for each chunk.
 
virtual std::vector< absl::StatusOr< data::Chunk > > ToChunks (absl::Span< const Value *const > values, std::string_view mimetype)
 Chunks holding values, in order, each with its own outcome.
 
virtual absl::StatusOr< Value > Adopt (const DtoPlan &shape, const Program &program, const Value &value)
 Adopts a validated value of a declared shape for the host.
 

Detailed Description

What the process running a flow knows and the language does not.

Three questions, all of them about types a serialisation registry has been told about: make a value one of them, read one out of a chunk, and write one into a chunk. The Python bindings answer them against the Python registry – which is where a pydantic model actually lives – and the standalone tool answers them with the C++ registry, so the same runtime drives both without either being the special case.

Constructor & Destructor Documentation

◆ ~HostBridge()

virtual a11::flow::HostBridge::~HostBridge ( )
virtualdefault

Member Function Documentation

◆ Adopt()

virtual absl::StatusOr< Value > a11::flow::HostBridge::Adopt ( const DtoPlan &  shape,
const Program &  program,
const Value &  value 
)
inlinevirtual

Adopts a validated value of a declared shape for the host.

program supplies referenced shapes. The default returns value.

◆ CanPassChunkObject()

bool a11::flow::HostBridge::CanPassChunkObject ( const data::Chunk &  chunk,
std::string_view  declared_type 
) const
virtual

Whether a typed port can retain this local object without conversion.

◆ Coerce()

virtual absl::StatusOr< Value > a11::flow::HostBridge::Coerce ( std::string_view  tag,
const Value &  value 
)
pure virtual

Make value a value of the type tag names.

tag is a dotted registry tag or a quoted mimetype: the built-in names are the language's own and are coerced before this is reached.

◆ FromChunk()

virtual absl::StatusOr< Value > a11::flow::HostBridge::FromChunk ( const data::Chunk &  chunk)
pure virtual

The value chunk holds.

◆ FromChunks()

virtual std::vector< absl::StatusOr< Value > > a11::flow::HostBridge::FromChunks ( absl::Span< const data::Chunk *const >  chunks)
inlinevirtual

Reads a batch in order, retaining a separate result for each chunk.

The default calls FromChunk for each item.

◆ ToChunk()

virtual absl::StatusOr< data::Chunk > a11::flow::HostBridge::ToChunk ( const Value &  value,
std::string_view  mimetype 
)
pure virtual

A chunk holding value, in mimetype when one is asked for.

◆ ToChunks()

virtual std::vector< absl::StatusOr< data::Chunk > > a11::flow::HostBridge::ToChunks ( absl::Span< const Value *const >  values,
std::string_view  mimetype 
)
inlinevirtual

Chunks holding values, in order, each with its own outcome.

The writing counterpart of [FromChunks]; the same reasoning applies.


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