载入中...
搜索中...
未找到
eve::schema::SchemaRegistry类 参考

Process-wide registry for runtime gameplay schemas. 更多...

#include <SchemaRegistry.h>

静态 Public 成员函数

static eve::Result< SchemaRegistrationStatus > registerSchema (const SchemaDefinition &definition)
 Registers or replaces the exact (id, version) entry.
 
static eve::Result< SchemaRegistrationStatus > registerFromJson (const std::string &json)
 Parses and registers or replaces one schema definition from JSON.
 
static eve::Result< SchemaRegistrationStatus > registerVersioned (const SchemaDefinition &definition)
 Registers a new exact (id, version) entry without replacing it.
 
static eve::Result< SchemaRegistrationStatus > registerFromJsonVersioned (const std::string &json)
 Parses and registers a new exact (id, schemaVersion) entry.
 
static const SchemaDefinition * find (const std::string &id)
 Finds the highest registered version for an id, or nullptr.
 
static const SchemaDefinition * resolve (const std::string &schemaId, int schemaVersion)
 Resolves one exact (schemaId, schemaVersion) pair, or nullptr.
 
static std::vector< int > versions (const std::string &schemaId)
 Returns all registered versions for an id in ascending order.
 
static eve::Result< void > remove (const std::string &id)
 Removes all registered versions for a stable id.
 
static eve::Result< void > remove (const std::string &id, int schemaVersion)
 Removes one exact schema version.
 
static void clear ()
 Clears all registered schemas.
 
static int count ()
 Returns the number of registered schema ids.
 
static int versionCount ()
 Returns the number of registered (id, version) entries.
 
static std::vector< std::string > ids ()
 Returns registered schema ids, unique and in deterministic lexical order.
 
static std::vector< ValidationError > validate (const std::string &schemaId, const std::string &json)
 Validates JSON text against the highest registered schema version.
 
static std::vector< ValidationError > validate (const std::string &schemaId, int schemaVersion, const std::string &json)
 Validates JSON against one exact schema version.
 
static eve::Result< void > registerMigration (const std::string &schemaId, int fromVersion, int toVersion, MigrationFunction migration)
 Registers one explicit forward migration edge.
 
static eve::Result< SchemaCompatibility > queryCompatibility (const std::string &schemaId, int fromVersion, int toVersion)
 Resolves an exact compatibility path without executing migrations.
 
static eve::Result< eve::Value > migrate (const std::string &schemaId, int fromVersion, int toVersion, const eve::Value &input)
 Applies an explicit migration chain to an owning payload.
 
static eve::Result< std::string > migrateJson (const std::string &schemaId, int fromVersion, int toVersion, const std::string &json)
 Parses, migrates and serializes a JSON payload through the chain.
 
static eve::Result< std::string > generateDocumentation (const std::string &schemaId, int schemaVersion)
 Produce stable Markdown for one exact registered schema.
 
static eve::Result< std::string > generateBindingContract (const std::string &schemaId, int schemaVersion)
 Produce a stable JSON binding contract for one exact schema.
 

详细描述

Process-wide registry for runtime gameplay schemas.

在文件 SchemaRegistry.h 第 35 行定义.

成员函数说明

◆ clear()

void eve::schema::SchemaRegistry::clear ( )
static

Clears all registered schemas.

在文件 SchemaRegistry.cpp 第 931 行定义.

被这些函数引用 eve::schema::Schema::clear().

◆ count()

int eve::schema::SchemaRegistry::count ( )
static

Returns the number of registered schema ids.

返回
Unique id count, independent of how many versions each id has.

在文件 SchemaRegistry.cpp 第 936 行定义.

被这些函数引用 eve::schema::Schema::getSchemaCount().

◆ find()

const SchemaDefinition * eve::schema::SchemaRegistry::find ( const std::string &  id)
static

Finds the highest registered version for an id, or nullptr.

This is the legacy id-only resolution rule. Use resolve() when the caller has a persisted schema version and must not silently select a newer definition.

返回
Borrowed nullable schema definition owned by the registry. @ownership SchemaRegistry owns the entry; callers must not delete or mutate it. @lifetime Valid until any registry mutation or destruction; copy data before registering another version. @thread Call on the schema registry thread. @reentrancy The lookup invokes no callbacks and is invalid across re-entrant mutation.

在文件 SchemaRegistry.cpp 第 859 行定义.

被这些函数引用 eve::schema::Schema::getFieldCount(), eve::schema::Schema::getSchemaAdditionalProperties(), eve::schema::Schema::getSchemaDescription(), eve::schema::Schema::getSchemaTitle(), eve::schema::Schema::getSchemaVersion(), eve::schema::Schema::has() , 以及 validate().

◆ generateBindingContract()

eve::Result< std::string > eve::schema::SchemaRegistry::generateBindingContract ( const std::string &  schemaId,
int  schemaVersion 
)
static

Produce a stable JSON binding contract for one exact schema.

参数
schemaIdStable schema id.
schemaVersionExact schema version.
返回
Canonical contract consumed by tooling/binding generators.

在文件 SchemaDocumentation.cpp 第 128 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), resolve(), eve::Result< T >::success(), eve::Value::toJson() , 以及 eve::UnknownVersion.

◆ generateDocumentation()

eve::Result< std::string > eve::schema::SchemaRegistry::generateDocumentation ( const std::string &  schemaId,
int  schemaVersion 
)
static

Produce stable Markdown for one exact registered schema.

参数
schemaIdStable schema id.
schemaVersionExact schema version.
返回
Minimal generated schema documentation.

在文件 SchemaDocumentation.cpp 第 109 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), output, resolve(), eve::Result< T >::success() , 以及 eve::UnknownVersion.

◆ ids()

std::vector< std::string > eve::schema::SchemaRegistry::ids ( )
static

Returns registered schema ids, unique and in deterministic lexical order.

在文件 SchemaRegistry.cpp 第 947 行定义.

引用了 size.

被这些函数引用 eve::schema::Schema::getSchemaId().

◆ migrate()

eve::Result< eve::Value > eve::schema::SchemaRegistry::migrate ( const std::string &  schemaId,
int  fromVersion,
int  toVersion,
const eve::Value &  input 
)
static

Applies an explicit migration chain to an owning payload.

参数
schemaIdStable schema id.
fromVersionExact version of input.
toVersionExact target version.
inputSource payload; never modified by this operation.
返回
Migrated owning payload, validated against the target schema.
备注
Migration callbacks receive const input and must return a new value. Callback or validation failure leaves both input and the registry unchanged.

在文件 SchemaRegistry.cpp 第 1069 行定义.

引用了 current, end, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Value::find(), index, input, eve::ParseError, path, queryCompatibility(), step, eve::Result< T >::success(), eve::Value::toJson(), toVersion, eve::Unsupported , 以及 validate().

被这些函数引用 migrateJson().

◆ migrateJson()

eve::Result< std::string > eve::schema::SchemaRegistry::migrateJson ( const std::string &  schemaId,
int  fromVersion,
int  toVersion,
const std::string &  json 
)
static

Parses, migrates and serializes a JSON payload through the chain.

参数
schemaIdStable schema id.
fromVersionExact source version.
toVersionExact target version.
jsonSource JSON payload.
返回
Canonical migrated JSON, or a structured failure.

在文件 SchemaRegistry.cpp 第 1119 行定义.

引用了 eve::Result< T >::failure(), eve::Value::fromJson(), input, migrate(), toVersion , 以及 value.

◆ queryCompatibility()

eve::Result< SchemaCompatibility > eve::schema::SchemaRegistry::queryCompatibility ( const std::string &  schemaId,
int  fromVersion,
int  toVersion 
)
static

Resolves an exact compatibility path without executing migrations.

参数
schemaIdStable schema id.
fromVersionPersisted source version.
toVersionSupported target version.
返回
Exact or explicitly chained compatibility path.
备注
Missing versions/links, cycles and downgrade requests are failures; the registry is never mutated by this query.

在文件 SchemaRegistry.cpp 第 1021 行定义.

引用了 eve::Conflict, current, end, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::schema::SchemaCompatibility::fromVersion, eve::InvalidArgument, resolve(), eve::schema::SchemaCompatibility::schemaId, eve::Result< T >::success(), toVersion, eve::schema::SchemaCompatibility::toVersion, eve::UnknownVersion, eve::Unsupported , 以及 eve::schema::SchemaCompatibility::versions.

被这些函数引用 migrate().

◆ registerFromJson()

eve::Result< SchemaRegistrationStatus > eve::schema::SchemaRegistry::registerFromJson ( const std::string &  json)
static

Parses and registers or replaces one schema definition from JSON.

参数
jsonJSON schema definition.
返回
Registered or Replaced, or a structured parse/validation failure.

在文件 SchemaRegistry.cpp 第 850 行定义.

引用了 error, eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::ParseError.

被这些函数引用 eve::schema::Schema::registerJson().

◆ registerFromJsonVersioned()

eve::Result< SchemaRegistrationStatus > eve::schema::SchemaRegistry::registerFromJsonVersioned ( const std::string &  json)
static

Parses and registers a new exact (id, schemaVersion) entry.

参数
jsonJSON schema definition. schemaVersion is canonical; version is accepted for compatibility. Supplying both with different values is rejected as a version conflict.
返回
Registered, or a structured parse/conflict/validation failure.

在文件 SchemaRegistry.cpp 第 869 行定义.

引用了 error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::ParseError , 以及 registerVersioned().

◆ registerMigration()

eve::Result< void > eve::schema::SchemaRegistry::registerMigration ( const std::string &  schemaId,
int  fromVersion,
int  toVersion,
MigrationFunction  migration 
)
static

Registers one explicit forward migration edge.

参数
schemaIdStable schema id whose payload is transformed.
fromVersionExact source version.
toVersionExact target version; it must be greater than source.
migrationPure function returning a new owning payload.
返回
Success, or a structured invalid/conflict failure. The registry is unchanged on every failure.
备注
One outgoing edge per source version is allowed. This makes a migration chain unambiguous and lets missing links be reported.

在文件 SchemaRegistry.cpp 第 987 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, key, eve::Result< T >::success(), toVersion , 以及 eve::Unsupported.

◆ registerSchema()

eve::Result< SchemaRegistrationStatus > eve::schema::SchemaRegistry::registerSchema ( const SchemaDefinition &  definition)
static

Registers or replaces the exact (id, version) entry.

参数
definitionSchema to copy into the registry.
返回
Registered or Replaced, or a structured validation failure.

在文件 SchemaRegistry.cpp 第 845 行定义.

引用了 error.

被这些函数引用 eve::schema::Schema::registerFromClass().

◆ registerVersioned()

eve::Result< SchemaRegistrationStatus > eve::schema::SchemaRegistry::registerVersioned ( const SchemaDefinition &  definition)
static

Registers a new exact (id, version) entry without replacing it.

参数
definitionSchema to copy into the registry.
返回
Registered, or a structured conflict/validation failure.

在文件 SchemaRegistry.cpp 第 864 行定义.

引用了 error.

被这些函数引用 eve::physics::FractureRecipe::ensureSchemaRegistered(), eve::physics::GeometryCollectionAsset::ensureSchemaRegistered(), eve::physics::GeometryCollectionInstanceSnapshot::ensureSchemaRegistered(), eve::physics::SoftBody3DDefinition::ensureSchemaRegistered(), eve::physics::SoftBodyModelDefinition::ensureSchemaRegistered() , 以及 registerFromJsonVersioned().

◆ remove() [1/2]

eve::Result< void > eve::schema::SchemaRegistry::remove ( const std::string &  id)
static

Removes all registered versions for a stable id.

参数
idStable schema id.
返回
Success, or NotFound when no version is registered.

在文件 SchemaRegistry.cpp 第 898 行定义.

引用了 eve::Applied, begin, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, removed, eve::Status::success() , 以及 eve::Result< T >::success().

◆ remove() [2/2]

eve::Result< void > eve::schema::SchemaRegistry::remove ( const std::string &  id,
int  schemaVersion 
)
static

Removes one exact schema version.

参数
idStable schema id.
schemaVersionExact version to remove.
返回
Success, or NotFound when that version is not registered.

在文件 SchemaRegistry.cpp 第 912 行定义.

引用了 eve::Applied, begin, end, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, removed, eve::Status::success() , 以及 eve::Result< T >::success().

◆ resolve()

const SchemaDefinition * eve::schema::SchemaRegistry::resolve ( const std::string &  schemaId,
int  schemaVersion 
)
static

Resolves one exact (schemaId, schemaVersion) pair, or nullptr.

参数
schemaIdStable schema id.
schemaVersionExact positive schema version.
返回
Borrowed nullable registry entry. @ownership SchemaRegistry owns the entry; callers must not delete or mutate it. @lifetime Valid until any registry mutation or destruction. @thread Call on the schema registry thread. @reentrancy The lookup invokes no callbacks and is invalid across re-entrant mutation.

在文件 SchemaRegistry.cpp 第 879 行定义.

引用了 end.

被这些函数引用 eve::physics::FractureRecipe::ensureSchemaRegistered(), eve::physics::GeometryCollectionAsset::ensureSchemaRegistered(), eve::physics::GeometryCollectionInstanceSnapshot::ensureSchemaRegistered(), eve::physics::SoftBody3DDefinition::ensureSchemaRegistered(), eve::physics::SoftBodyModelDefinition::ensureSchemaRegistered(), generateBindingContract(), generateDocumentation(), eve::schema::Schema::hasVersion(), queryCompatibility() , 以及 validate().

◆ validate() [1/2]

std::vector< ValidationError > eve::schema::SchemaRegistry::validate ( const std::string &  schemaId,
const std::string &  json 
)
static

Validates JSON text against the highest registered schema version.

参数
schemaIdStable id of the schema to use.
jsonJSON-compatible value to validate.
返回
All discovered failures; empty means valid.

在文件 SchemaRegistry.cpp 第 955 行定义.

引用了 find() , 以及 validate().

被这些函数引用 migrate(), eve::physics::Rope::newRope3DFromJson(), validate(), eve::schema::Schema::validateJson() , 以及 eve::schema::Schema::validateJsonVersioned().

◆ validate() [2/2]

std::vector< ValidationError > eve::schema::SchemaRegistry::validate ( const std::string &  schemaId,
int  schemaVersion,
const std::string &  json 
)
static

Validates JSON against one exact schema version.

在文件 SchemaRegistry.cpp 第 965 行定义.

引用了 eve::json::Document::parse(), resolve() , 以及 root.

◆ versionCount()

int eve::schema::SchemaRegistry::versionCount ( )
static

Returns the number of registered (id, version) entries.

返回
Total number of schema versions across all ids.

在文件 SchemaRegistry.cpp 第 938 行定义.

引用了 versions().

◆ versions()

std::vector< int > eve::schema::SchemaRegistry::versions ( const std::string &  schemaId)
static

Returns all registered versions for an id in ascending order.

参数
schemaIdStable schema id.
返回
Empty when the id is absent.

在文件 SchemaRegistry.cpp 第 886 行定义.

引用了 end.

被这些函数引用 eve::schema::Schema::getSchemaVersionAt(), eve::schema::Schema::getSchemaVersionCount() , 以及 versionCount().


该类的文档由以下文件生成: