pub trait StateStore: Send + Sync {
// Required methods
fn read_state(&self, id: &str) -> Result<Option<Vec<u8>>>;
fn write_state(&self, id: &str, value: &[u8]) -> Result<()>;
}Expand description
A pluggable key/value state store — the Rust analog of Go’s ipn.StateStore
(Server::store).
Scope (be honest). Unlike Go — which persists the full node state (prefs + netmap +
machine key) — this fork’s engine only persists node identity keys. So a StateStore here
round-trips exactly one value: the PersistState identity blob under STATE_KEY. The trait
is intentionally the general KV shape so it stays forward-compatible: when the engine grows
prefs/netmap persistence, more keys slot in with no caller change. See the design doc.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".