backuptask: track copy and upload statistics

This commit is contained in:
Girish Ramakrishnan
2025-10-20 13:22:51 +02:00
parent 854661e2d4
commit 07732310c1
7 changed files with 52 additions and 41 deletions

View File

@@ -71,7 +71,7 @@ async function addFile(sourceFile, encryption, uploader, progressCallback) {
await uploader.finish();
return {
stats: ps.stats(), // { startTime, totalMsecs, transferred }
stats: { transferred: ps.stats().transferred },
integrity: { size: ps.stats().transferred, sha256: hash.digest('hex') }
};
}
@@ -91,8 +91,6 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
transferred: 0,
size: [...integrityMap.values()].reduce((sum, integrity) => sum + (integrity?.size || 0), 0), // integrity can be null if file had disappeared during upload
fileCount: addQueue.length + integrityMap.size, // final file count, not the transferred file count
startTime: Date.now(),
totalMsecs: 0
};
const destPathIntegrityMap = new Map(); // unlike integrityMap which contains local filenames, this contains destination filenames (maybe encrypted)
@@ -138,7 +136,7 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
await syncer.finalize(integrityMap, cacheFile);
return {
stats: { ...aggregatedStats, totalMsecs: Date.now()-aggregatedStats.startTime },
stats: aggregatedStats,
integrityMap: destPathIntegrityMap
};
}