Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore { /* private fields */ }

Implementations§

Source§

impl MemoryStore

Source

pub fn new() -> Self

Source

pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()>

Source

pub fn load_from_path(path: impl AsRef<Path>) -> Result<Self>

Source

pub fn create_run(&mut self, initial_state: State) -> (String, String)

Source

pub fn claim_step( &mut self, worker_id: &str, run_id: &str, lease_seconds: f64, ) -> Result<StepClaim>

Source

pub fn load_state(&self, run_id: &str) -> Result<(State, u64, String)>

Source

pub fn recover_expired_leases(&mut self) -> usize

Source

pub fn cancel_run(&mut self, run_id: &str, reason: &str) -> Result<usize>

Source

pub fn commit_state_patch( &mut self, run_id: &str, step_id: &str, lease_token: &str, base_version: u64, patch: State, ) -> Result<u64>

Source

pub fn mark_retry( &mut self, run_id: &str, step_id: &str, error_type: &str, message: &str, )

Source

pub fn mark_waiting_human( &mut self, run_id: &str, step_id: &str, reason: &str, approval_id: &str, )

Source

pub fn mark_failed( &mut self, run_id: &str, step_id: &str, error_type: &str, message: &str, )

Source

pub fn append_event( &mut self, run_id: &str, session_id: Option<&str>, step_id: Option<&str>, event_type: &str, payload: State, agent_role: Option<&str>, state_version: Option<u64>, causal_token: Option<&str>, ) -> Event

Source

pub fn reserve_ledger( &mut self, key: &str, entry: ToolLedgerEntry, ) -> Option<ToolLedgerEntry>

Source

pub fn update_ledger( &mut self, key: &str, status: &str, response: Option<Value>, error_type: Option<String>, )

Source

pub fn request_approval( &mut self, approval_key: &str, run_id: &str, session_id: &str, step_id: &str, tool_name: &str, risk_level: &str, reason: &str, request_hash: &str, request_ref: &str, requested_by: &str, ) -> ApprovalRequest

Source

pub fn approval_for_key(&self, approval_key: &str) -> Option<ApprovalRequest>

Source

pub fn approval_requests(&self, run_id: &str) -> Vec<ApprovalRequest>

Source

pub fn approve_request( &mut self, approval_id: &str, approver: &str, reason: &str, ) -> Result<ApprovalRequest>

Source

pub fn deny_request( &mut self, approval_id: &str, approver: &str, reason: &str, ) -> Result<ApprovalRequest>

Source

pub fn record_cost( &mut self, run_id: &str, session_id: &str, step_id: &str, category: &str, name: &str, amount: f64, unit: &str, metadata: State, ) -> String

Source

pub fn cost_records(&self, run_id: &str) -> Vec<CostRecord>

Source

pub fn cost_summary(&self, run_id: &str) -> CostSummary

Source

pub fn create_artifact( &mut self, run_id: &str, step_id: Option<&str>, name: &str, content: State, metadata: State, ) -> Artifact

Source

pub fn artifacts(&self, run_id: &str) -> Vec<Artifact>

Source

pub fn validate_lease(&self, step_id: &str, lease_token: &str) -> Result<()>

Source

pub fn final_state(&self, run_id: &str) -> Result<State>

Source

pub fn run(&self, run_id: &str) -> Result<Run>

Source

pub fn steps(&self, run_id: &str) -> Vec<Step>

Source

pub fn events(&self, run_id: &str) -> Vec<Event>

Source

pub fn ledger(&self, run_id: &str) -> Vec<ToolLedgerEntry>

Trait Implementations§

Source§

impl Default for MemoryStore

Source§

fn default() -> MemoryStore

Returns the “default value” for a type. 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, 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.