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

Seal and restore all registered domain owners as one game-save transaction. 更多...

#include <GameSaveSession.h>

Public 成员函数

 GameSaveSession (std::string contentVersion)
 Configure the exact current content contract; empty identifiers are rejected by operations.
 
Result< void > add (IGameSaveParticipant &participant)
 Borrow one domain participant for this session's lifetime.
 
Result< void > addContentMigration (std::string fromVersion, std::function< Result< Value >(const Value &)> migrate)
 Register a direct old-to-current content migration before loading.
 
Result< std::string > snapshotJson (const SnapshotHashProvider &hashProvider) const
 Capture and integrity-seal every participant in deterministic key order.
 
Result< void > restoreJson (std::string_view json, const SnapshotHashProvider &hashProvider)
 Verify, migrate and prepare all participants before any publication.
 

详细描述

Seal and restore all registered domain owners as one game-save transaction.

备注
Schema game:save-session version 1 rejects unknown fields and unknown participants. Content migrations are explicit pure functions over an owning participants payload.

在文件 GameSaveSession.h 第 48 行定义.

构造及析构函数说明

◆ GameSaveSession()

eve::GameSaveSession::GameSaveSession ( std::string  contentVersion)
explicit

Configure the exact current content contract; empty identifiers are rejected by operations.

在文件 GameSaveSession.cpp 第 16 行定义.

成员函数说明

◆ add()

Result< void > eve::GameSaveSession::add ( IGameSaveParticipant &  participant)

Borrow one domain participant for this session's lifetime.

返回
Conflict for a duplicate key, InvalidArgument for an empty key. @thread Owning simulation thread only; do not change registration during capture or restore.

在文件 GameSaveSession.cpp 第 18 行定义.

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

◆ addContentMigration()

Result< void > eve::GameSaveSession::addContentMigration ( std::string  fromVersion,
std::function< Result< Value >(const Value &)>  migrate 
)

Register a direct old-to-current content migration before loading.

参数
fromVersionNonempty prior content identifier.
migratePure transformation of the owning participants object; no live mutation.
返回
Conflict for a duplicate route or InvalidArgument for an empty route. @reentrancy The callback is invoked without locks before any participant preparation. @cost One full participants payload copy and migration per load.

在文件 GameSaveSession.cpp 第 29 行定义.

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

◆ restoreJson()

Result< void > eve::GameSaveSession::restoreJson ( std::string_view  json,
const SnapshotHashProvider &  hashProvider 
)

Verify, migrate and prepare all participants before any publication.

参数
jsonBorrowed serialized save bytes needed only during this call.
hashProviderThe same digest contract used at capture.
返回
Applied only after every no-fail participant commit has completed.
备注
Missing or extra participants, bad hashes and failed preparations leave live state unchanged. @cost O(total serialized game state), once per load.

在文件 GameSaveSession.cpp 第 57 行定义.

引用了 eve::Applied, eve::Value::asString(), eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::find(), eve::Value::getIf(), eve::InvalidArgument, eve::Value::isObject(), eve::Value::isString(), key, eve::ParseError, eve::parseSnapshotEnvelope(), payload, eve::PreconditionViolation, state, eve::Status::success(), eve::Result< T >::success(), eve::UnknownVersion , 以及 eve::Unsupported.

◆ snapshotJson()

Result< std::string > eve::GameSaveSession::snapshotJson ( const SnapshotHashProvider &  hashProvider) const

Capture and integrity-seal every participant in deterministic key order.

参数
hashProviderRequired schema-owned digest implementation.
返回
Owning versioned JSON; any participant failure aborts capture. @cost O(total serialized game state), once per save.

在文件 GameSaveSession.cpp 第 40 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), key, eve::makeSnapshotEnvelope(), eve::detail::Id128< Tag >::nil(), payload, eve::PreconditionViolation, eve::serializeSnapshotEnvelope() , 以及 state.


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