MCPcopy Create free account
hub / github.com/Tong89/smartNode / snapshot

Method snapshot

backend/core.py:2299–2316  ·  view source on GitHub ↗

拍摄仿真快照,返回快照字典。 快照包含当前时间、全部请求、资源占用、统计数据等。 主仿真循环继续运行,不受影响。 Parameters ---------- label: 可选的快照标签(便于人类识别)。 Returns ------- dict 符合 Snapshot Schema 的字典,可直接序列化为 JSON。

(self, label: str = "")

Source from the content-addressed store, hash-verified

2297 # ==========================================
2298
2299 def snapshot(self, label: str = "") -> dict:
2300 """拍摄仿真快照,返回快照字典。
2301
2302 快照包含当前时间、全部请求、资源占用、统计数据等。
2303 主仿真循环继续运行,不受影响。
2304
2305 Parameters
2306 ----------
2307 label:
2308 可选的快照标签(便于人类识别)。
2309
2310 Returns
2311 -------
2312 dict
2313 符合 Snapshot Schema 的字典,可直接序列化为 JSON。
2314 """
2315 from backend.snapshot import SnapshotManager
2316 return SnapshotManager.take(self, label=label)
2317
2318 def restore(self, snapshot_data: dict) -> dict:
2319 """从快照字典恢复仿真状态,进入回放模式(主循环暂停)。

Callers 4

snapshot_saveFunction · 0.80

Calls 1

takeMethod · 0.80