feat(infra): temp IdeA généralisé à tous les agents + purge du store managed-tmp au shutdown d'IdeA — #200 (QA verte)
This commit is contained in:
@ -191,6 +191,32 @@ impl GcManagedTemp {
|
||||
}
|
||||
}
|
||||
|
||||
/// Output for [`PurgeManagedTemp`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct PurgeManagedTempOutput {
|
||||
/// Purge report.
|
||||
pub report: ManagedTempGcReport,
|
||||
}
|
||||
|
||||
/// Eagerly purges all managed temporary allocations.
|
||||
pub struct PurgeManagedTemp {
|
||||
store: Arc<dyn ManagedTempStore>,
|
||||
}
|
||||
|
||||
impl PurgeManagedTemp {
|
||||
/// Builds the use case.
|
||||
#[must_use]
|
||||
pub fn new(store: Arc<dyn ManagedTempStore>) -> Self {
|
||||
Self { store }
|
||||
}
|
||||
|
||||
/// Executes the purge.
|
||||
pub async fn execute(&self) -> Result<PurgeManagedTempOutput, AppError> {
|
||||
let report = self.store.purge_all().await?;
|
||||
Ok(PurgeManagedTempOutput { report })
|
||||
}
|
||||
}
|
||||
|
||||
fn now_ms(clock: &Arc<dyn Clock>) -> u64 {
|
||||
u64::try_from(clock.now_millis()).unwrap_or(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user