storage: pass limits object to backend

This commit is contained in:
Girish Ramakrishnan
2025-11-14 13:18:21 +01:00
parent cb30a57a59
commit e106dcd76a
8 changed files with 37 additions and 24 deletions

View File

@@ -107,7 +107,7 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
if (change.operation === 'removedir') {
debug(`sync: removing directory ${fullPath}`);
await backupSites.storageApi(backupSite).removeDir(backupSite.config, fullPath, progressCallback);
await backupSites.storageApi(backupSite).removeDir(backupSite.config, backupSite.limits, fullPath, progressCallback);
} else if (change.operation === 'remove') {
debug(`sync: removing ${fullPath}`);
await backupSites.storageApi(backupSite).remove(backupSite.config, fullPath);
@@ -115,7 +115,7 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
await promiseRetry({ times: 5, interval: 20000, debug }, async (retryCount) => {
progressCallback({ message: `Adding ${change.path}` + (retryCount > 1 ? ` (Try ${retryCount})` : '') });
debug(`sync: adding ${change.path} position ${change.position} try ${retryCount}`);
const uploader = await backupSites.storageApi(backupSite).upload(backupSite.config, fullPath);
const uploader = await backupSites.storageApi(backupSite).upload(backupSite.config, backupSite.limits, fullPath);
const result = await addFile(dataLayout.toLocalPath('./' + change.path), backupSite.encryption, uploader, progressCallback);
integrityMap.set(change.path, result.integrity); // .integrity can be null when file disappeared on us
destPathIntegrityMap.set(destPath, result.integrity);
@@ -308,7 +308,7 @@ async function copy(backupSite, fromPath, toPath, progressCallback) {
assert.strictEqual(typeof toPath, 'string');
assert.strictEqual(typeof progressCallback, 'function');
await backupSites.storageApi(backupSite).copyDir(backupSite.config, fromPath, toPath, progressCallback);
await backupSites.storageApi(backupSite).copyDir(backupSite.config, backupSite.limits, fromPath, toPath, progressCallback);
}
function getFileExtension(encryption) {

View File

@@ -264,7 +264,7 @@ async function upload(backupSite, remotePath, dataLayout, progressCallback) {
return await promiseRetry({ times: 5, interval: 20000, debug }, async () => {
progressCallback({ message: `Uploading backup ${remotePath}` });
const uploader = await backupSites.storageApi(backupSite).upload(backupSite.config, remotePath);
const uploader = await backupSites.storageApi(backupSite).upload(backupSite.config, backupSite.limits, remotePath);
const { stats, integrity } = await tarPack(dataLayout, backupSite.encryption, uploader, progressCallback);
// use '.' instead of remote path since the backup can be moved to another path