pub struct StateManager { /* private fields */ }Expand description
Global execution state manager
Implementations§
Source§impl StateManager
impl StateManager
pub fn new() -> Self
Sourcepub async fn initialize_context(
&self,
initial_state: &Value,
) -> Result<(), Error>
pub async fn initialize_context( &self, initial_state: &Value, ) -> Result<(), Error>
Initialize the execution context with initial state
Sourcepub async fn update_context(
&self,
updates: &HashMap<String, Value>,
) -> Result<(), Error>
pub async fn update_context( &self, updates: &HashMap<String, Value>, ) -> Result<(), Error>
Update the current execution context
Sourcepub async fn get_current_context(&self) -> Result<Value, Error>
pub async fn get_current_context(&self) -> Result<Value, Error>
Get current context snapshot
Sourcepub async fn store_persistent(
&self,
key: &str,
value: Value,
) -> Result<(), Error>
pub async fn store_persistent( &self, key: &str, value: Value, ) -> Result<(), Error>
Store persistent data that survives across tool calls
Sourcepub async fn get_persistent(&self, key: &str) -> Result<Option<Value>, Error>
pub async fn get_persistent(&self, key: &str) -> Result<Option<Value>, Error>
Retrieve persistent data
Sourcepub async fn create_snapshot(&self) -> Result<ContextSnapshot, Error>
pub async fn create_snapshot(&self) -> Result<ContextSnapshot, Error>
Create a checkpoint snapshot of current state
Sourcepub async fn restore_snapshot(&self, snapshot_id: &str) -> Result<(), Error>
pub async fn restore_snapshot(&self, snapshot_id: &str) -> Result<(), Error>
Restore from a specific snapshot
Sourcepub async fn get_latest_snapshot(
&self,
) -> Result<Option<ContextSnapshot>, Error>
pub async fn get_latest_snapshot( &self, ) -> Result<Option<ContextSnapshot>, Error>
Get the most recent snapshot
Sourcepub async fn optimize_memory(&self) -> Result<MemoryOptimizationResult, Error>
pub async fn optimize_memory(&self) -> Result<MemoryOptimizationResult, Error>
Optimize memory usage by compressing old snapshots
Sourcepub async fn get_current_memory_usage(&self) -> Result<MemoryUsage, Error>
pub async fn get_current_memory_usage(&self) -> Result<MemoryUsage, Error>
Get current memory usage statistics
Sourcepub async fn cleanup_expired_data(&self) -> Result<u32, Error>
pub async fn cleanup_expired_data(&self) -> Result<u32, Error>
Clean up expired data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StateManager
impl !RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl !UnwindSafe for StateManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more