backup / restoreslop

This commit is contained in:
legop3
2026-09-14 19:09:02 -04:00
parent edc1b825f2
commit 1c34849bd0
32 changed files with 1220 additions and 70 deletions
@@ -508,6 +508,16 @@ function createStorage({ logger }) {
}), { available: false, path: DB_PATH });
}
function backupDatabase(destinationPath) {
/*
Fleet collection may continue during an online SQLite backup. Each
resulting database file represents a valid point-in-time snapshot even
when new telemetry commits before the copy completes.
*/
if (!open()) throw new Error('Fleet report database is unavailable.');
return db.backup(destinationPath);
}
return {
open,
insertEvent,
@@ -525,6 +535,7 @@ function createStorage({ logger }) {
getActiveBattery,
replaceBattery,
getDiagnostics,
backupDatabase,
};
}