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 |
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.
|
default |
Constructs an empty registry.
| 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.
| 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.
|
noexcept |
Finds a type by exact domain and name.
|
inlinenoexcept |
Opaque identity shared by copies of this immutable registry.
| 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.
|
noexcept |
Returns all types sorted by domain and type name.
|
friend |