VLink  2.0.0
A high-performance communication middleware
schema_plugin_base.h File Reference

Reference base class mapping SchemaPluginInterface onto Protobuf descriptors and a BFBS registry. More...

#include <algorithm>
#include <cctype>
#include <cstring>
#include <memory>
#include <mutex>
#include <queue>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "../base/helpers.h"
#include "./schema_plugin_interface.h"
#include "./flatbuffers_registry.h"
#include "./protobuf_registry.h"
Include dependency graph for schema_plugin_base.h:

Go to the source code of this file.

Classes

class  vlink::SchemaPluginBase
 Reusable base implementation of SchemaPluginInterface for mixed Protobuf / FlatBuffers metadata. More...
 

Namespaces

 

Detailed Description

Reference base class mapping SchemaPluginInterface onto Protobuf descriptors and a BFBS registry.

SchemaPluginBase is a header-only implementation that downstream schema plugins normally derive from. It supplies the canonical Protobuf and FlatBuffers backends so that custom plugins only need to specialise version information and any extra metadata; behavioural compatibility with the original protobuf-only runtime is preserved by funnelling every Protobuf lookup through DescriptorPool::generated_pool() and serialising payloads as a FileDescriptorSet captured from the linked descriptor graph. FlatBuffers does not provide an analogous global pool, so the concrete plugin is expected to register BFBS blobs through the FlatbuffersRegistry singleton (or the VLINK_REGISTER_FLATBUFFERS macro) before any lookups occur.

Implemented method Behaviour
search_schema() probe over Protobuf, FlatBuffers, and vlink::zerocopy::*
get_all_schemas() import all known BFBS blobs and return the cached schema set
search_protobuf_descriptor() cache and return descriptors from the generated Protobuf pool
create_protobuf_message() build a dynamic message via DynamicMessageFactory and cache it
search_flatbuffers_schema() verify the BFBS blob and return a stable reflection::Schema
create_flatbuffers_parser() deserialise the BFBS blob into a parser and remember it for cleanup
Integration diagram
+---------------------+ +-----------------------+ +--------------------------+
| downstream plugin | -----> | SchemaPluginBase | -----> | DescriptorPool / generated|
| (overrides version) | | (this header) | +--------------------------+
+---------------------+ | | +--------------------------+
| | -----> | FlatbuffersRegistry |
| | | (static BFBS slots) |
+-----------------------+ +--------------------------+