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 cloneImplementations§
Source§impl InMemoryStore
impl InMemoryStore
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty in-memory store.
§Examples
use ironflow_store::memory::InMemoryStore;
let store = InMemoryStore::new();Sourcepub async fn set_run_created_at(&self, run_id: Uuid, created_at: DateTime<Utc>)
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
impl ApiKeyStore for InMemoryStore
Source§fn create_api_key(&self, req: NewApiKey) -> StoreFuture<'_, ApiKey>
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>>
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>>
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>>
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<'_, ()>
fn update_api_key(&self, id: Uuid, update: ApiKeyUpdate) -> StoreFuture<'_, ()>
Update an API key.
Source§fn touch_api_key(&self, id: Uuid) -> StoreFuture<'_, ()>
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<'_, ()>
fn delete_api_key(&self, id: Uuid) -> StoreFuture<'_, ()>
Delete an API key.
Source§impl ArtifactStore for InMemoryStore
impl ArtifactStore for InMemoryStore
Source§fn create_artifact(&self, artifact: NewArtifact) -> StoreFuture<'_, Artifact>
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>>
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>>
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>>
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
impl AuditLogStore for InMemoryStore
Source§fn append_audit_log(
&self,
entry: NewAuditLogEntry,
) -> StoreFuture<'_, AuditLogEntry>
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>>
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
impl Clone for InMemoryStore
Source§fn clone(&self) -> InMemoryStore
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryStore
impl Debug for InMemoryStore
Source§impl Default for InMemoryStore
impl Default for InMemoryStore
Source§impl LogStore for InMemoryStore
impl LogStore for InMemoryStore
Source§fn append_logs(&self, entries: NewLogEntries) -> StoreFuture<'_, ()>
fn append_logs(&self, entries: NewLogEntries) -> StoreFuture<'_, ()>
Persist a batch of log lines. Read more
Source§impl RunStore for InMemoryStore
impl RunStore for InMemoryStore
Source§fn create_run(&self, req: NewRun) -> StoreFuture<'_, RunCreation>
fn create_run(&self, req: NewRun) -> StoreFuture<'_, RunCreation>
Create a new run in
Pending status. Read moreSource§fn find_run_by_idempotency_key(&self, key: &str) -> StoreFuture<'_, Option<Run>>
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>>
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>>
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<'_, ()>
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<'_, ()>
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>>
fn pick_next_pending( &self, lease: Option<LeaseRequest>, ) -> StoreFuture<'_, Option<Run>>
Atomically pick the oldest pending run and transition it to
Running. Read moreSource§fn renew_lease(
&self,
id: Uuid,
lease: LeaseRequest,
) -> StoreFuture<'_, DateTime<Utc>>
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>>
fn reap_expired_leases(&self, limit: u32) -> StoreFuture<'_, Vec<ReapedRun>>
Recover runs whose worker lease expired, at most
limit per call. Read moreSource§fn list_purgeable_runs(
&self,
policy: &PurgePolicy,
batch_size: u32,
) -> StoreFuture<'_, Vec<PurgeableRun>>
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>>
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>
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<'_, ()>
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>>
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>>
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>
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<'_, ()>
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>>
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>
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
impl SecretStore for InMemoryStore
Source§fn get_secret(&self, key: &str) -> StoreFuture<'_, Option<Secret>>
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>
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>
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>>
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>>
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>
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>
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
impl UserStore for InMemoryStore
Source§fn create_user(&self, req: NewUser) -> StoreFuture<'_, User>
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>>
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>>
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>
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>>
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<'_, ()>
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>
fn update_user_role(&self, id: Uuid, is_admin: bool) -> StoreFuture<'_, User>
Update a user’s admin role. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryStore
impl !UnwindSafe for InMemoryStore
impl Freeze for InMemoryStore
impl Send for InMemoryStore
impl Sync for InMemoryStore
impl Unpin for InMemoryStore
impl UnsafeUnpin for InMemoryStore
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