VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::SchemaData Struct Referencefinal

Carries one serialized schema blob for runtime registration or embedding. More...

#include <types.h>

Collaboration diagram for vlink::SchemaData:

Static Public Member Functions

static bool is_valid_type (SchemaType schema_type) noexcept
 Returns whether a schema type enum value is within the supported range.
static bool is_real_type (SchemaType schema_type) noexcept
 Returns whether a schema type carries concrete runtime schema metadata.
static std::string_view convert_type (SchemaType schema_type) noexcept
 Converts a schema type to its canonical persisted encoding label.
static SchemaType convert_encoding (std::string_view encoding) noexcept
 Parses a schema type from an encoding label.
static constexpr SchemaType infer_ser_type (std::string_view ser_type) noexcept
 Infers a coarse schema family directly from a concrete ser_type string.
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.

Public Attributes

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

Detailed Description

Carries one serialized schema blob for runtime registration or embedding.

Used by schema-aware tools such as bag readers, MCAP writers, and schema plugins to move imported schema metadata around without assuming a specific schema language. The encoding field stores the original schema payload encoding (for example "protobuf", "flatbuffers", or "vlink_msg"), while schema_type captures the coarse runtime family used by discovery, bag routing, and proxy consumers.

Member Function Documentation

◆ convert_encoding()

SchemaType vlink::SchemaData::convert_encoding ( std::string_view encoding)
staticnodiscardnoexcept

Parses a schema type from an encoding label.

Parameters
encodingEncoding string such as "protobuf", "fbs", "blob", or "zerocopy".
Returns
Matching schema type, or SchemaType::kUnknown.
Here is the call graph for this function:

◆ convert_type()

std::string_view vlink::SchemaData::convert_type ( SchemaType schema_type)
staticnodiscardnoexcept

Converts a schema type to its canonical persisted encoding label.

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

◆ infer_ser_type()

SchemaType vlink::SchemaData::infer_ser_type ( std::string_view ser_type)
staticnodiscardconstexprnoexcept

Infers a coarse schema family directly from a concrete ser_type string.

Details.

This lightweight constexpr helper is intentionally conservative:

  • zero-copy types are recognised by the "vlink::zerocopy::" prefix
  • textual/raw payload types map to SchemaType::kRaw
  • protobuf / flatbuffers are not guessed from names here
Parameters
ser_typeConcrete serialisation type string.
Returns
Matching schema family, or SchemaType::kUnknown.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_real_type()

bool vlink::SchemaData::is_real_type ( SchemaType schema_type)
staticnodiscardnoexcept

Returns whether a schema type carries concrete runtime schema metadata.

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

Parameters
schema_typeSchema type value to classify.
Returns
true for protobuf / flatbuffers / zerocopy families.

◆ is_valid_type()

bool vlink::SchemaData::is_valid_type ( SchemaType schema_type)
staticnodiscardnoexcept

Returns whether a schema type enum value is within the supported range.

Parameters
schema_typeSchema type value to validate.
Returns
true when schema_type is a supported enum member.

◆ resolve_type()

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

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

Resolution order is:

  1. explicit schema_type when already known
  2. inferred family from encoding
  3. inferred family from ser_type
Parameters
schema_typeExplicit schema family hint.
ser_typeConcrete serialisation type string.
encodingPersisted schema encoding label.
Returns
Best-effort resolved schema family, or SchemaType::kUnknown.

Member Data Documentation

◆ data

Bytes vlink::SchemaData::data

Raw serialized schema bytes (e.g. FileDescriptorSet or BFBS).

◆ encoding

std::string vlink::SchemaData::encoding

Schema encoding identifier (e.g. "protobuf" or "flatbuffers").

◆ name

std::string vlink::SchemaData::name

Schema subject name, typically a fully-qualified message or table type.

◆ schema_type

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

Coarse runtime schema family derived from encoding.


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