VLink  2.0.0
A high-performance communication middleware
vlink::SchemaData结构体 参考final

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

#include <types.h>

vlink::SchemaData 的协作图:

静态 Public 成员函数

static bool is_valid_type (SchemaType schema_type) noexcept
 Returns whether schema_type is within the supported enum range. 更多...
 
static bool is_real_type (SchemaType schema_type) noexcept
 Returns whether schema_type carries concrete 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 an encoding string back into a SchemaType value. 更多...
 
static constexpr SchemaType infer_ser_type (std::string_view ser_type) noexcept
 Infers a coarse schema family 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 属性

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

详细描述

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.

成员函数说明

◆ convert_encoding()

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

Parses an encoding string back into a SchemaType value.

参数
encodingEncoding label such as "protobuf", "fbs", "blob" or "zerocopy".
返回
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.

参数
schema_typeValue to convert.
返回
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.
参数
ser_typeConcrete serialisation type string.
返回
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.

参数
schema_typeValue to classify.
返回
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.

参数
schema_typeValue to validate.
返回
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.
参数
schema_typeExplicit schema family hint.
ser_typeConcrete serialisation type string.
encodingPersisted schema encoding label.
返回
Best-effort schema family, or SchemaType::kUnknown.

类成员变量说明

◆ 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.


该结构体的文档由以下文件生成: