Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::timeline::SchemaRegistry Class Reference

Immutable, shareable registry of Timeline schema contracts. More...

#include <schema_registry.hpp>

Public Member Functions

 SchemaRegistry ()=default
 Constructs an empty registry.
const TypeSchema * find (SchemaDomain domain, std::string_view type_name) const noexcept
 Finds a type by exact domain and name.
std::span< const TypeSchema > types () const noexcept
 Returns all types sorted by domain and type name.
std::shared_ptr< const void > identity () const noexcept
 Opaque identity shared by copies of this immutable registry.
runtime::Result< std::string, PersistenceError > migrate (SchemaDomain domain, std::string_view type_name, std::uint32_t source_version, std::uint32_t target_version, std::string_view source_envelope, const DecodeLimits &limits={}) const
 Migrates an exact envelope along registered adjacent version edges.
runtime::Result< std::string, PersistenceError > encode_registered (SchemaDomain domain, const SchemaIdentity &identity, const std::shared_ptr< const void > &value, std::size_t maximum_bytes) const
 Encodes a current-version registered value under a byte ceiling.
runtime::Result< RegisteredContent, PersistenceError > create_registered_no_owned_ids (const SchemaIdentity &identity, std::shared_ptr< const void > value, std::size_t maximum_bytes) const
 Creates registered Content after bounded encode and canonical validation.

Friends

class SchemaRegistryBuilder

Detailed Description

Immutable, shareable registry of Timeline schema contracts.

A default-constructed registry is empty. Registries produced by a builder share immutable backing storage and support concurrent lookup. Concurrent encode, decode, or migration calls additionally require the registered callbacks and their shared contexts to be thread-safe.

Constructor & Destructor Documentation

◆ SchemaRegistry()

pulp::timeline::SchemaRegistry::SchemaRegistry ( )
default

Constructs an empty registry.

Member Function Documentation

◆ create_registered_no_owned_ids()

runtime::Result< RegisteredContent, PersistenceError > pulp::timeline::SchemaRegistry::create_registered_no_owned_ids ( const SchemaIdentity & identity,
std::shared_ptr< const void > value,
std::size_t maximum_bytes ) const

Creates registered Content after bounded encode and canonical validation.

The value must be non-null and use the type's current version. The returned RegisteredContent shares ownership of value and stores canonical object JSON plus a saturated retained-size estimate. This helper is for content that owns no Timeline ItemIds.

◆ encode_registered()

runtime::Result< std::string, PersistenceError > pulp::timeline::SchemaRegistry::encode_registered ( SchemaDomain domain,
const SchemaIdentity & identity,
const std::shared_ptr< const void > & value,
std::size_t maximum_bytes ) const

Encodes a current-version registered value under a byte ceiling.

The returned string is the codec's output; callers that require canonical JSON should use create_registered_no_owned_ids.

◆ find()

const TypeSchema * pulp::timeline::SchemaRegistry::find ( SchemaDomain domain,
std::string_view type_name ) const
noexcept

Finds a type by exact domain and name.

Returns
A pointer valid for the registry backing-store lifetime, or nullptr.

◆ identity()

std::shared_ptr< const void > pulp::timeline::SchemaRegistry::identity ( ) const
inlinenoexcept

Opaque identity shared by copies of this immutable registry.

◆ migrate()

runtime::Result< std::string, PersistenceError > pulp::timeline::SchemaRegistry::migrate ( SchemaDomain domain,
std::string_view type_name,
std::uint32_t source_version,
std::uint32_t target_version,
std::string_view source_envelope,
const DecodeLimits & limits = {} ) const

Migrates an exact envelope along registered adjacent version edges.

Each intermediate result is bounded, parsed, and validated for the expected type and version. Equal source and target versions return a copy of the validated input without canonicalizing it.

◆ types()

std::span< const TypeSchema > pulp::timeline::SchemaRegistry::types ( ) const
noexcept

Returns all types sorted by domain and type name.

◆ SchemaRegistryBuilder

friend class SchemaRegistryBuilder
friend

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