VLink  2.0.0
A high-performance communication middleware
vlink::SchemaData Struct Referencefinal

Wire-format-neutral wrapper around one serialised schema blob. More...

#include <types.h>

Collaboration diagram for vlink::SchemaData:

Static Public Member Functions

static bool is_valid_type (SchemaType schema_type) noexcept
 Returns whether schema_type is within the supported enum range. More...
 
static bool is_real_type (SchemaType schema_type) noexcept
 Returns whether schema_type carries concrete schema metadata. More...
 
static std::string_view convert_type (SchemaType schema_type) noexcept
 Converts a schema type to its canonical persisted encoding label. More...
 
static SchemaType convert_encoding (std::string_view encoding) noexcept
 Parses an encoding string back into a SchemaType value. More...
 
static constexpr SchemaType infer_ser_type (std::string_view ser_type) noexcept
 Infers a coarse schema family from a concrete ser_type string. More...
 
static SchemaType resolve_type (SchemaType schema_type, std::string_view ser_type={}, std::string_view encoding={}) noexcept
 Resolves the best available schema family from explicit, encoding and ser hints. More...
 

Public Attributes

std::string name
 Schema subject (usually a fully qualified message or table name). More...
 
std::string encoding
 Schema encoding identifier, e.g. "protobuf" or "flatbuffers". More...
 
SchemaType schema_type {SchemaType::kUnknown}
 Coarse runtime family derived from encoding. More...
 
Bytes data
 Raw serialised schema bytes (FileDescriptorSet, BFBS, ...). More...
 

Detailed Description

Wire-format-neutral wrapper around one serialised schema blob.

Consumed by schema-aware tooling such as bag readers, MCAP writers and schema plugins. encoding stores the original schema payload encoding (for example "protobuf", "flatbuffers" or "vlink_msg"); the schema_type field exposes the coarse runtime family used by discovery, bag routing and proxy consumers.

Member Function Documentation

◆ convert_encoding()

static SchemaType vlink::SchemaData::convert_encoding ( std::string_view  encoding)
staticnoexcept

Parses an encoding string back into a SchemaType value.

Parameters
encodingEncoding label such as "protobuf", "fbs", "blob" or "zerocopy".
Returns
Matching SchemaType, or SchemaType::kUnknown.

◆ convert_type()

static std::string_view vlink::SchemaData::convert_type ( SchemaType  schema_type)
staticnoexcept

Converts a schema type to its canonical persisted encoding label.

Parameters
schema_typeValue to convert.
Returns
Canonical encoding string, or an empty view for unknown values.

◆ infer_ser_type()

constexpr SchemaType vlink::SchemaData::infer_ser_type ( std::string_view  ser_type)
staticconstexprnoexcept

Infers a coarse schema family from a concrete ser_type string.

Details.

Intentionally conservative:

  • Zero-copy types are recognised by the "vlink::zerocopy::" prefix.
  • Textual / raw payload types map to SchemaType::kRaw.
  • Protobuf and FlatBuffers are not guessed from name alone.
Parameters
ser_typeConcrete serialisation type string.
Returns
Inferred schema family, or SchemaType::kUnknown.

◆ is_real_type()

static bool vlink::SchemaData::is_real_type ( SchemaType  schema_type)
staticnoexcept

Returns whether schema_type carries concrete schema metadata.

Unlike is_valid_type(), excludes kUnknown and kRaw. Used by schema caching / bag embedding code to decide whether the schema can be indexed or persisted as a real schema entry.

Parameters
schema_typeValue to classify.
Returns
true for protobuf, flatbuffers and zero-copy families.

◆ is_valid_type()

static bool vlink::SchemaData::is_valid_type ( SchemaType  schema_type)
staticnoexcept

Returns whether schema_type is within the supported enum range.

Parameters
schema_typeValue to validate.
Returns
true when schema_type names a defined enum member.

◆ resolve_type()

static SchemaType vlink::SchemaData::resolve_type ( SchemaType  schema_type,
std::string_view  ser_type = {},
std::string_view  encoding = {} 
)
staticnoexcept

Resolves the best available schema family from explicit, encoding and ser hints.

Resolution order:

  1. Use schema_type when it is already known.
  2. Otherwise infer from encoding.
  3. Otherwise infer from ser_type.
Parameters
schema_typeExplicit schema family hint.
ser_typeConcrete serialisation type string.
encodingPersisted schema encoding label.
Returns
Best-effort schema family, or SchemaType::kUnknown.

Member Data Documentation

◆ data

Bytes vlink::SchemaData::data

Raw serialised schema bytes (FileDescriptorSet, BFBS, ...).

◆ encoding

std::string vlink::SchemaData::encoding

Schema encoding identifier, e.g. "protobuf" or "flatbuffers".

◆ name

std::string vlink::SchemaData::name

Schema subject (usually a fully qualified message or table name).

◆ schema_type

SchemaType vlink::SchemaData::schema_type {SchemaType::kUnknown}

Coarse runtime family derived from encoding.


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