Skip to main content

StateStore

Trait StateStore 

Source
pub trait StateStore: Send + Sync {
    // Required methods
    fn get(&self, node_id: &str) -> Result<Option<Arc<Value>>>;
    fn set(&self, node_id: &str, state: Value) -> Result<()>;
    fn remove(&self, node_id: &str) -> Result<()>;
    fn clear(&self) -> Result<()>;
    fn keys(&self) -> Result<Vec<String>>;
}
Expand description

Storage for trained filter states, keyed by node id.

Implementations must be Send + Sync and use interior mutability so the store can be shared (via Arc) across the executor and the graph session.

Required Methods§

Source

fn get(&self, node_id: &str) -> Result<Option<Arc<Value>>>

Fetch the state for node_id, if present.

Source

fn set(&self, node_id: &str, state: Value) -> Result<()>

Store state under node_id, replacing any previous value.

Source

fn remove(&self, node_id: &str) -> Result<()>

Remove the state for node_id, if present.

Source

fn clear(&self) -> Result<()>

Drop all stored states.

Source

fn keys(&self) -> Result<Vec<String>>

List all node ids that currently have a stored state.

Implementors§