pub trait DaemonStorage: Send + Sync {
// Required methods
fn persist_daemon<'life0, 'life1, 'async_trait, T>(
&'life0 self,
record: &'life1 DaemonRecord<T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where AnyDaemonRecord: From<DaemonRecord<T>>,
T: 'async_trait + DaemonState + Clone,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_daemon<'life0, 'async_trait>(
&'life0 self,
daemon_id: DaemonId,
) -> Pin<Box<dyn Future<Output = Result<AnyDaemonRecord>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_daemons<'life0, 'async_trait>(
&'life0 self,
status_filter: Option<DaemonStatus>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyDaemonRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn purge_orphaned_rows<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn purge_model_filter_events<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
keep_per_model: i64,
retention_secs: f64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Daemon lifecycle persistence.
This trait provides storage operations for tracking daemon state, including registration, heartbeat updates, and graceful shutdown.
Required Methods§
Sourcefn persist_daemon<'life0, 'life1, 'async_trait, T>(
&'life0 self,
record: &'life1 DaemonRecord<T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
AnyDaemonRecord: From<DaemonRecord<T>>,
T: 'async_trait + DaemonState + Clone,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn persist_daemon<'life0, 'life1, 'async_trait, T>(
&'life0 self,
record: &'life1 DaemonRecord<T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
AnyDaemonRecord: From<DaemonRecord<T>>,
T: 'async_trait + DaemonState + Clone,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist daemon state update.
This is a low-level method used by state transition methods.
The type parameter T ensures type-safe state transitions.
Sourcefn get_daemon<'life0, 'async_trait>(
&'life0 self,
daemon_id: DaemonId,
) -> Pin<Box<dyn Future<Output = Result<AnyDaemonRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_daemon<'life0, 'async_trait>(
&'life0 self,
daemon_id: DaemonId,
) -> Pin<Box<dyn Future<Output = Result<AnyDaemonRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get daemon by ID.
Returns an AnyDaemonRecord which can hold the daemon in any state.
Sourcefn list_daemons<'life0, 'async_trait>(
&'life0 self,
status_filter: Option<DaemonStatus>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyDaemonRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_daemons<'life0, 'async_trait>(
&'life0 self,
status_filter: Option<DaemonStatus>,
) -> Pin<Box<dyn Future<Output = Result<Vec<AnyDaemonRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all daemons with optional status filter.
If status_filter is None, returns all daemons regardless of status.
Otherwise, returns only daemons matching the specified status.
Sourcefn purge_orphaned_rows<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn purge_orphaned_rows<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Purge orphaned request_templates and requests whose parent (file or batch) has been soft-deleted or whose FK is NULL.
Deletes at most batch_size rows from each table per call.
Returns total rows deleted across both tables. Called periodically by
the daemon purge task for right-to-erasure compliance.
Sourcefn purge_model_filter_events<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
keep_per_model: i64,
retention_secs: f64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn purge_model_filter_events<'life0, 'async_trait>(
&'life0 self,
batch_size: i64,
keep_per_model: i64,
retention_secs: f64,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Purge old model_filters events, ALWAYS retaining, per model, the most
recent keep_per_model events (so the current-state lookup and a short
history window survive) AND every event newer than retention_secs
regardless of count.
Deletes at most batch_size rows per call. Returns rows deleted.
Called periodically by the daemon purge task to bound the append-only
log. keep_per_model >= 1 guarantees the latest event per model is
never purged, so the claim gate never loses a model’s current state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".