coven/handle_discarded_devices.rs
1//! Deleting the installations resets kept, at the app's request (§19.3, E5).
2
3use crate::*;
4
5impl CovenHandle {
6 /// Delete the installations `reset_device` kept in this store's directory,
7 /// each moved aside when its reset swapped it out (§19.3). Nothing reads
8 /// them once the reset's notice is in the database, and the store's own
9 /// files stay. In one step, coven moves each archive out of the
10 /// directory into a removal folder and deletes its row in
11 /// `coven_archive_bytes`, then it deletes that folder. Returns once it
12 /// has deleted them and synced the directory. A failure midway returns
13 /// its error and leaves the rest for the next call, which removes what
14 /// remains; with none left it succeeds.
15 pub async fn delete_discarded_devices(&self) -> CovenResult<()> {
16 self.database.delete_discarded_devices().await.map_err(|error| match error {
17 DbError::Disk(file) => CovenError::File(file),
18 error => error.into(),
19 })
20 }
21}
22
23#[cfg(test)]
24#[path = "handle_discarded_devices_tests.rs"]
25mod tests;