coven/handle_file_cleanup.rs
1//! Deleting the stored files of devices gone for good at the app's request
2//! (§17.10, E5).
3
4use crate::*;
5
6impl CovenHandle {
7 /// Delete the stored files of devices gone for good (§14.1) that nothing
8 /// refers to (§17.10): for every such device this device is responsible
9 /// for, end the uploads it left and delete the snapshot bodies of its
10 /// that no announcement names (§16.6), list its file folder again, then
11 /// delete each file found that no retained row, write or snapshot names,
12 /// once every other device not gone for good has published a write that
13 /// read past the listing; later
14 /// passes delete the rest as those writes arrive. A gone device can keep
15 /// uploading while its provider access still works, but nothing it
16 /// writes after the entry that stopped it counts, so this is safe to run
17 /// at any time.
18 /// Returns once the listing and deletions finish, or with the failure
19 /// that stopped them; `SyncError::SnapshotPending` while a snapshot of
20 /// this device's is still being published.
21 pub async fn clean_up_gone_devices_files(&self) -> Result<(), SyncError> {
22 Box::pin(self.storage.clean_up_gone_devices_files()).await
23 }
24}
25
26#[cfg(test)]
27#[path = "handle_file_cleanup_tests.rs"]
28mod tests;