One state hot-reload transaction: capture → reload → restore. 更多...
#include <ReloadSession.h>
Public 成员函数 | |
| ReloadSession (const ReloadSession &)=delete | |
| ReloadSession & | operator= (const ReloadSession &)=delete |
| bool | begin (HSQUIRRELVM vm, std::string *err=nullptr) |
| Start a session: capture current script + native state. | |
| bool | commit (HSQUIRRELVM vm, std::string *err=nullptr) |
| Restore captured state over the new definitions. | |
| bool | abort (HSQUIRRELVM vm, std::string *err=nullptr) |
| End the session, rolling back to the captured state. | |
| bool | active () const |
| Whether a session is currently open. | |
静态 Public 成员函数 | |
| static ReloadSession & | instance () |
| Instance. | |
详细描述
One state hot-reload transaction: capture → reload → restore.
A script reload (soft_reload_scripts) drives this via the eve.dev API:
- begin(): snapshot script state roots + every registered IStateProvider into an in-memory buffer, and persist
eve_snapshot.jsonas a manual rollback point. - (scripts are re-dofile'd in between)
- commit(): restore the captured state on top of the new definitions — captured root values win, fields the new script added are kept, native providers are restored (falling back to resetToDefaults() on failure).
- abort(): restore the captured state unchanged and clear the session.
在文件 ReloadSession.h 第 28 行定义.
构造及析构函数说明
◆ ReloadSession()
|
delete |
成员函数说明
◆ abort()
| bool eve::dev::ReloadSession::abort | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
End the session, rolling back to the captured state.
在文件 ReloadSession.cpp 第 70 行定义.
引用了 eve::dev::Snapshot::instance(), eve::StateValue::null(), ok, eve::dev::Snapshot::setRootPolicies() , 以及 vm.
◆ active()
|
inline |
Whether a session is currently open.
在文件 ReloadSession.h 第 54 行定义.
◆ begin()
| bool eve::dev::ReloadSession::begin | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
Start a session: capture current script + native state.
- 返回
- false when capture fails (session stays inactive).
在文件 ReloadSession.cpp 第 12 行定义.
引用了 eve::dev::Snapshot::instance(), eve::StateValue::null(), eve::dev::Snapshot::roots(), eve::dev::Snapshot::saveFile(), eve::dev::Snapshot::transientRoots() , 以及 vm.
◆ commit()
| bool eve::dev::ReloadSession::commit | ( | HSQUIRRELVM | vm, |
| std::string * | err = nullptr |
||
| ) |
Restore captured state over the new definitions.
On success the session ends. On failure the original capture remains active so the caller can repair definition bindings and call abort().
在文件 ReloadSession.cpp 第 32 行定义.
引用了 current, eve::StateValue::find(), eve::dev::Snapshot::instance(), eve::StateValue::isObject(), eve::StateValue::keys(), eve::StateValue::mergeDefaults(), name, eve::StateValue::null(), ok , 以及 vm.
◆ instance()
|
static |
Instance.
在文件 ReloadSession.cpp 第 7 行定义.
被这些函数引用 eve::dev::executeSoftRestart() , 以及 eve::dev::DevTool::exposeScriptApi().
◆ operator=()
|
delete |
该类的文档由以下文件生成:
- src/engine/devtools/ReloadSession.h
- src/engine/devtools/ReloadSession.cpp