17 lines
480 B
Rust
17 lines
480 B
Rust
//! Agent state snapshot for persistence
|
|
//!
|
|
//! Port of `agent_snapshot.c` / `agent_snapshot.h` from the C project.
|
|
|
|
use crate::db;
|
|
|
|
/// Save the agent state snapshot.
|
|
pub fn agent_snapshot_save(state_json: &str) -> Result<(), Box<dyn std::error::Error>> {
|
|
db::db_kv_set("agent.snapshot", state_json)?;
|
|
Ok(())
|
|
}
|
|
|
|
/// Load the agent state snapshot.
|
|
pub fn agent_snapshot_load() -> Result<Option<String>, Box<dyn std::error::Error>> {
|
|
db::db_kv_get("agent.snapshot")
|
|
}
|