One directed payload migration step. 更多...
#include <Snapshot.h>
Public 类型 | |
| using | Migration = std::function< Result< Value >(const Value &payload)> |
Public 成员函数 | |
| Result< void > | add (LogicalId schema, SchemaVersion from, SchemaVersion to, Migration migration) |
| Register one schema-local migration edge. | |
| Result< SnapshotEnvelope > | migrate (SnapshotEnvelope snapshot, SchemaVersion targetVersion, const SnapshotHashProvider &hashProvider) const |
| Migrate and reseal an envelope to an exact target version. | |
详细描述
One directed payload migration step.
Steps must move forward to a larger version. The chain never guesses a missing step and never accepts an envelope newer than the requested target.
在文件 Snapshot.h 第 145 行定义.
成员类型定义说明
◆ Migration
| using eve::SnapshotMigrationChain::Migration = std::function<Result<Value>(const Value& payload)> |
在文件 Snapshot.h 第 147 行定义.
成员函数说明
◆ add()
| Result< void > eve::SnapshotMigrationChain::add | ( | LogicalId | schema, |
| SchemaVersion | from, | ||
| SchemaVersion | to, | ||
| Migration | migration | ||
| ) |
Register one schema-local migration edge.
- 参数
-
schema Schema whose payload is transformed. from Version accepted by migration. to Version produced by migration; must be greater than from. migration Pure function that returns a new owning payload.
- 返回
- Success, or Conflict/InvalidArgument when the edge is invalid or duplicated.
在文件 Snapshot.cpp 第 196 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::LogicalId::format(), from, eve::InvalidArgument, eve::LogicalId::isValid(), key, eve::Result< T >::success() , 以及 to.
◆ migrate()
| Result< SnapshotEnvelope > eve::SnapshotMigrationChain::migrate | ( | SnapshotEnvelope | snapshot, |
| SchemaVersion | targetVersion, | ||
| const SnapshotHashProvider & | hashProvider | ||
| ) | const |
Migrate and reseal an envelope to an exact target version.
- 参数
-
snapshot Verified source envelope; it is consumed on success. targetVersion Required current version. hashProvider Provider used to verify source and seal migrated output.
- 返回
- Migrated envelope, or UnknownVersion/Unsupported/failure.
- 备注
- If source is newer than target, it is rejected as an unknown new version.
在文件 Snapshot.cpp 第 208 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::LogicalId::format(), eve::SnapshotEnvelope::instanceId, key, eve::makeSnapshotEnvelope(), eve::SnapshotEnvelope::payload, payload, eve::SnapshotEnvelope::revision, eve::SnapshotEnvelope::schema, eve::SnapshotEnvelope::schemaVersion, step, eve::Result< T >::success(), eve::SnapshotEnvelope::tick, eve::SnapshotEnvelope::type, eve::UnknownVersion, eve::Unsupported, eve::detail::StrongUint64< Tag >::value() , 以及 eve::verifySnapshotEnvelope().
该类的文档由以下文件生成:
- src/engine/common/Snapshot.h
- src/engine/common/Snapshot.cpp