Skip to main content

InMemoryStore

Struct InMemoryStore 

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

In-memory store backed by Arc<RwLock<..>>.

Thread-safe and cheap to clone. All data is held in memory and lost on drop. Implements Store so a single Arc<InMemoryStore> covers runs, users, API keys, and secrets.

§Examples

use ironflow_store::memory::InMemoryStore;

let store = InMemoryStore::new();
let store2 = store.clone(); // cheap Arc clone

Implementations§

Source§

impl InMemoryStore

Source

pub fn new() -> Self

Create a new empty in-memory store.

§Examples
use ironflow_store::memory::InMemoryStore;

let store = InMemoryStore::new();
Source

pub async fn set_run_created_at(&self, run_id: Uuid, created_at: DateTime<Utc>)

Override a run’s created_at timestamp for testing retention policies.

§Examples
use chrono::{Utc, TimeDelta};
use ironflow_store::memory::InMemoryStore;
use uuid::Uuid;

let old = Utc::now() - TimeDelta::days(100);
store.set_run_created_at(run_id, old).await;

Trait Implementations§

Source§

impl ApiKeyStore for InMemoryStore

Source§

fn create_api_key(&self, req: NewApiKey) -> StoreFuture<'_, ApiKey>

Create a new API key.
Source§

fn find_api_key_by_prefix( &self, prefix: &str, ) -> StoreFuture<'_, Option<ApiKey>>

Find an API key by its prefix (first 8 chars). Read more
Source§

fn find_api_key_by_id(&self, id: Uuid) -> StoreFuture<'_, Option<ApiKey>>

Find an API key by ID.
Source§

fn list_api_keys_by_user(&self, user_id: Uuid) -> StoreFuture<'_, Vec<ApiKey>>

List all API keys for a user.
Source§

fn update_api_key(&self, id: Uuid, update: ApiKeyUpdate) -> StoreFuture<'_, ()>

Update an API key.
Source§

fn touch_api_key(&self, id: Uuid) -> StoreFuture<'_, ()>

Record that an API key was used (updates last_used_at).
Source§

fn delete_api_key(&self, id: Uuid) -> StoreFuture<'_, ()>

Delete an API key.
Source§

impl ArtifactStore for InMemoryStore

Source§

fn create_artifact(&self, artifact: NewArtifact) -> StoreFuture<'_, Artifact>

Record a new artifact. Read more
Source§

fn get_artifact( &self, step_id: Uuid, name: &str, ) -> StoreFuture<'_, Option<Artifact>>

Look up one artifact of a step by name. Read more
Source§

fn list_artifacts_for_run(&self, run_id: Uuid) -> StoreFuture<'_, Vec<Artifact>>

List every artifact of a run, across all steps and attempts. Read more
Source§

fn find_artifact_for_input( &self, lookup: ArtifactLookup, ) -> StoreFuture<'_, Option<Artifact>>

Resolve the artifact a step declared as an input. Read more
Source§

impl AuditLogStore for InMemoryStore

Source§

fn append_audit_log( &self, entry: NewAuditLogEntry, ) -> StoreFuture<'_, AuditLogEntry>

Persist a new audit log entry. Read more
Source§

fn list_audit_logs( &self, filter: AuditLogFilter, page: u32, per_page: u32, ) -> StoreFuture<'_, Page<AuditLogEntry>>

List audit log entries matching the given filter, with pagination. Read more
Source§

impl Clone for InMemoryStore

Source§

fn clone(&self) -> InMemoryStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InMemoryStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InMemoryStore

Source§

fn default() -> Self

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

impl LogStore for InMemoryStore

Source§

fn append_logs(&self, entries: NewLogEntries) -> StoreFuture<'_, ()>

Persist a batch of log lines. Read more
Source§

fn get_logs( &self, run_id: Uuid, filter: LogFilter, cursor: Option<Uuid>, limit: u32, ) -> StoreFuture<'_, Vec<LogEntry>>

Retrieve log entries for a run with cursor-based pagination. Read more
Source§

impl RunStore for InMemoryStore

Source§

fn create_run(&self, req: NewRun) -> StoreFuture<'_, RunCreation>

Create a new run in Pending status. Read more
Source§

fn find_run_by_idempotency_key(&self, key: &str) -> StoreFuture<'_, Option<Run>>

Look up the run bound to an idempotency key. Read more
Source§

fn get_run(&self, id: Uuid) -> StoreFuture<'_, Option<Run>>

Get a run by ID. Returns None if not found.
Source§

fn list_runs( &self, filter: RunFilter, page: u32, per_page: u32, ) -> StoreFuture<'_, Page<Run>>

List runs matching the given filter, with pagination. Read more
Source§

fn update_run_status( &self, id: Uuid, new_status: RunStatus, ) -> StoreFuture<'_, ()>

Update a run’s status with FSM validation. Read more
Source§

fn update_run(&self, id: Uuid, update: RunUpdate) -> StoreFuture<'_, ()>

Apply a partial update to a run. Read more
Source§

fn pick_next_pending( &self, lease: Option<LeaseRequest>, ) -> StoreFuture<'_, Option<Run>>

Atomically pick the oldest pending run and transition it to Running. Read more
Source§

fn renew_lease( &self, id: Uuid, lease: LeaseRequest, ) -> StoreFuture<'_, DateTime<Utc>>

Extend the worker lease on a run and return the new expiry. Read more
Source§

fn reap_expired_leases(&self, limit: u32) -> StoreFuture<'_, Vec<ReapedRun>>

Recover runs whose worker lease expired, at most limit per call. Read more
Source§

fn list_purgeable_runs( &self, policy: &PurgePolicy, batch_size: u32, ) -> StoreFuture<'_, Vec<PurgeableRun>>

List runs eligible for purging according to the given policy. Read more
Source§

fn delete_run(&self, id: Uuid) -> StoreFuture<'_, Vec<String>>

Delete a run and all its associated data (steps, step dependencies). Read more
Source§

fn create_step(&self, req: NewStep) -> StoreFuture<'_, Step>

Create a new step for a run. Read more
Source§

fn update_step(&self, id: Uuid, update: StepUpdate) -> StoreFuture<'_, ()>

Apply a partial update to a step after execution. Read more
Source§

fn get_step(&self, id: Uuid) -> StoreFuture<'_, Option<Step>>

Get a single step by ID. Returns None if not found.
Source§

fn list_steps(&self, run_id: Uuid) -> StoreFuture<'_, Vec<Step>>

List all steps for a run, ordered by position ascending.
Source§

fn get_stats(&self, filter: RunFilter) -> StoreFuture<'_, RunStats>

Get aggregated statistics across runs matching the filter. Read more
Source§

fn create_step_dependencies( &self, deps: Vec<NewStepDependency>, ) -> StoreFuture<'_, ()>

Create step dependency edges in batch. Read more
Source§

fn list_step_dependencies( &self, run_id: Uuid, ) -> StoreFuture<'_, Vec<StepDependency>>

List all step dependencies for a given run. Read more
Source§

fn update_run_returning( &self, id: Uuid, update: RunUpdate, ) -> StoreFuture<'_, Run>

Apply a partial update to a run and return the updated run. Read more
Source§

impl SecretStore for InMemoryStore

Source§

fn get_secret(&self, key: &str) -> StoreFuture<'_, Option<Secret>>

Retrieve a secret by key. Read more
Source§

fn set_secret(&self, key: &str, value: &str) -> StoreFuture<'_, Secret>

Create or update a secret. Read more
Source§

fn delete_secret(&self, key: &str) -> StoreFuture<'_, bool>

Delete a secret by key. Read more
Source§

fn list_secret_keys(&self, prefix: &str) -> StoreFuture<'_, Vec<String>>

List all secret keys matching a prefix. Read more
Source§

fn list_secrets( &self, prefix: &str, page: u32, per_page: u32, ) -> StoreFuture<'_, Page<SecretMetadata>>

List secret metadata matching a prefix, with pagination. Read more
Source§

fn secret_key_status(&self) -> StoreFuture<'_, KeyVersionStatus>

Report how the configured key ring lines up with the stored secrets. Read more
Source§

fn rotate_secrets( &self, request: RotationRequest, ) -> StoreFuture<'_, RotationBatch>

Re-encrypt one batch of secrets towards the target key version. Read more
Source§

impl UserStore for InMemoryStore

Source§

fn create_user(&self, req: NewUser) -> StoreFuture<'_, User>

Create a new user. Read more
Source§

fn find_user_by_email(&self, email: &str) -> StoreFuture<'_, Option<User>>

Find a user by email. Returns None if not found.
Source§

fn find_user_by_id(&self, id: Uuid) -> StoreFuture<'_, Option<User>>

Find a user by ID. Returns None if not found.
Source§

fn count_users(&self) -> StoreFuture<'_, u64>

Count all users in the store.
Source§

fn list_users(&self, page: u32, per_page: u32) -> StoreFuture<'_, Page<User>>

List users with pagination, ordered by created_at descending.
Source§

fn delete_user(&self, id: Uuid) -> StoreFuture<'_, ()>

Delete a user by ID. Read more
Source§

fn update_user_role(&self, id: Uuid, is_admin: bool) -> StoreFuture<'_, User>

Update a user’s admin role. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Store for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.