Struct Redis Backend

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

1pub struct RedisBackend { /* private fields */ }

A Redis-backed storage backend for cross-process shared state.

Uses [ConnectionManager] which is Clone (internally Arc-based) and automatically reconnects on transient failures. Trie persistence uses an atomic single JSON blob SET - no partial update is possible.

Implementations

impl RedisBackend

impl RedisBackend

new

pub async fn new(url: &str, key_prefix: impl Into<String>) -> Result<Self>

Connect to Redis and return a new RedisBackend.

Arguments
  • url - Redis connection URL (e.g. redis://127.0.0.1:6379).
  • key_prefix - String prepended to every Redis key (e.g. "nemo_relay:").
Errors

Returns AdaptiveError::Storage if the client cannot be created or the connection cannot be established.

Trait Implementations

impl StorageBackend for RedisBackend

impl StorageBackend for RedisBackend

store_run

fn store_run(
    &self,
    record: &RunRecord,
) -> impl Future<Output = Result<()>> + Send

load_plan

fn load_plan(
    &self,
    agent_id: &str,
) -> impl Future<Output = Result<Option<ExecutionPlan>>> + Send

list_runs

fn list_runs(
    &self,
    agent_id: &str,
) -> impl Future<Output = Result<Vec<RunRecord>>> + Send

impl StorageBackendDyn for RedisBackend

impl StorageBackendDyn for RedisBackend

store_run_dyn

fn store_run_dyn<'a>(
    &'a self,
    record: &'a RunRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>

load_plan_dyn

fn load_plan_dyn<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<ExecutionPlan>>> + Send + 'a>>

list_runs_dyn

fn list_runs_dyn<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>>> + Send + 'a>>

store_trie

fn store_trie<'a>(
    &'a self,
    agent_id: &'a str,
    envelope: &'a TrieEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>

load_trie

fn load_trie<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<TrieEnvelope>>> + Send + 'a>>

store_accumulators

fn store_accumulators<'a>(
    &'a self,
    agent_id: &'a str,
    state: &'a AccumulatorState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>

load_accumulators

fn load_accumulators<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<AccumulatorState>>> + Send + 'a>>

store_plan

fn store_plan(&self, plan: &ExecutionPlan) -> Result<()>

store_observations

fn store_observations<'a>(
    &'a self,
    agent_id: &'a str,
    observations: &'a [PromptIR],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>

load_observations

fn load_observations<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<PromptIR>>>> + Send + 'a>>

store_stability

fn store_stability<'a>(
    &'a self,
    agent_id: &'a str,
    result: &'a StabilityAnalysisResult,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>

load_stability

fn load_stability<'a>(
    &'a self,
    agent_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<StabilityAnalysisResult>>> + Send + 'a>>