Skip to main content

InMemoryBackend

Struct InMemoryBackend 

Source
pub struct InMemoryBackend { /* private fields */ }
Expand description

In-memory backend storing adaptive state in process-local hash maps.

This backend is primarily useful for tests, examples, or deployments where adaptive state does not need to survive process restarts.

Implementations§

Source§

impl InMemoryBackend

Source

pub fn new() -> Self

Create an empty in-memory backend.

§Returns

A new InMemoryBackend with empty storage maps.

Trait Implementations§

Source§

impl Default for InMemoryBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl StorageBackend for InMemoryBackend

Source§

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

Persist one observed run.
Source§

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

Load the current execution plan for an agent.
Source§

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

List stored runs for an agent.
Source§

impl StorageBackendDyn for InMemoryBackend

Source§

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

Persist one observed run.
Source§

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

Load the current execution plan for an agent.
Source§

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

List stored runs for an agent.
Source§

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

Persist a serialized prediction trie for an agent.
Source§

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

Load the serialized prediction trie for an agent.
Source§

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

Persist trie accumulator state for an agent.
Source§

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

Load trie accumulator state for an agent.
Source§

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

Persist an execution plan for an agent. Read more
Source§

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

Persist prompt IR observations for an agent or derived Adaptive Cache Governor (ACG) profile. Read more
Source§

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

Load prompt IR observations for an agent or derived Adaptive Cache Governor (ACG) profile. Read more
Source§

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

Persist an ACG stability result for an agent or derived profile. Read more
Source§

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

Load an ACG stability result for an agent or derived profile. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.