-
Notifications
You must be signed in to change notification settings - Fork 9
Add change detection hook to CoveEncryptedBackend #600
Copy link
Copy link
Closed as not planned
Labels
cspp:phase:5CSPP Phase 5: Explicit redb Cloud Upload + Startup SyncCSPP Phase 5: Explicit redb Cloud Upload + Startup Sync
Milestone
Description
Add a change_sender: Option<flume::Sender<BackupEvent>> to CoveEncryptedBackend so the cloud backup actor knows when redb files change on disk.
Hook point: sync_data() — fires after redb flushes writes (better than write() which fires many times per commit).
pub struct BackupEvent {
pub file_path: PathBuf,
pub timestamp: SystemTime,
}fn sync_data(&self, _eventual: bool) -> Result<(), io::Error> {
self.file.sync_data()?;
if let Some(sender) = &self.change_sender {
let _ = sender.try_send(BackupEvent {
file_path: self.path.clone(),
timestamp: SystemTime::now(),
});
}
Ok(())
}A single global flume::Sender<BackupEvent> is shared by all CoveEncryptedBackend instances (set up during open_or_create_database()). The receiver feeds the CloudBackupActor.
Risk: redb may call sync_data() multiple times per transaction commit — debounce in the actor handles this, but worth verifying the call pattern doesn't create excessive channel traffic.
Files: rust/src/database/encrypted_backend.rs, rust/src/database.rs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cspp:phase:5CSPP Phase 5: Explicit redb Cloud Upload + Startup SyncCSPP Phase 5: Explicit redb Cloud Upload + Startup Sync
Type
Projects
Status
Done