From 461f8f3d07ebfef120cb8f024481ca5d76f0967f Mon Sep 17 00:00:00 2001 From: williamlardier Date: Tue, 26 Mar 2024 16:31:59 +0100 Subject: [PATCH] S3UTILS-155: split the restoring and restored into current and nonCurrent --- CountItems/utils/utils.js | 24 +- ...ucketMetricsAndUpdateBucketCapacityInfo.js | 12 +- tests/functional/utils/S3UtilsMongoClient.js | 408 +++++++++----- tests/unit/CountItems/CountManager.js | 96 ++-- tests/unit/CountItems/utils/utils.js | 36 +- tests/unit/utils/S3UtilsMongoClient.js | 504 ++++++++++++------ utils/S3UtilsMongoClient.js | 60 ++- 7 files changed, 756 insertions(+), 384 deletions(-) diff --git a/CountItems/utils/utils.js b/CountItems/utils/utils.js index 7096bb16..e6f81d3a 100644 --- a/CountItems/utils/utils.js +++ b/CountItems/utils/utils.js @@ -11,10 +11,12 @@ function consolidateDataMetrics(target, source) { usedCapacity: { current: 0, nonCurrent: 0, - restored: 0, - restoring: 0, currentCold: 0, nonCurrentCold: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }); } @@ -25,8 +27,10 @@ function consolidateDataMetrics(target, source) { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, deleteMarker: 0, }, }); @@ -39,16 +43,20 @@ function consolidateDataMetrics(target, source) { resTarget.usedCapacity.nonCurrent += usedCapacity && usedCapacity.nonCurrent ? usedCapacity.nonCurrent : 0; resTarget.usedCapacity.currentCold += usedCapacity && usedCapacity.currentCold ? usedCapacity.currentCold : 0; resTarget.usedCapacity.nonCurrentCold += usedCapacity && usedCapacity.nonCurrentCold ? usedCapacity.nonCurrentCold : 0; - resTarget.usedCapacity.restoring += usedCapacity && usedCapacity.restoring ? usedCapacity.restoring : 0; - resTarget.usedCapacity.restored += usedCapacity && usedCapacity.restored ? usedCapacity.restored : 0; + resTarget.usedCapacity.currentRestoring += usedCapacity && usedCapacity.currentRestoring ? usedCapacity.currentRestoring : 0; + resTarget.usedCapacity.currentRestored += usedCapacity && usedCapacity.currentRestored ? usedCapacity.currentRestored : 0; + resTarget.usedCapacity.nonCurrentRestoring += usedCapacity && usedCapacity.nonCurrentRestoring ? usedCapacity.nonCurrentRestoring : 0; + resTarget.usedCapacity.nonCurrentRestored += usedCapacity && usedCapacity.nonCurrentRestored ? usedCapacity.nonCurrentRestored : 0; resTarget.objectCount.current += objectCount && objectCount.current ? objectCount.current : 0; resTarget.objectCount.nonCurrent += objectCount && objectCount.nonCurrent ? objectCount.nonCurrent : 0; resTarget.objectCount.deleteMarker += objectCount && objectCount.deleteMarker ? objectCount.deleteMarker : 0; resTarget.objectCount.currentCold += objectCount && objectCount.currentCold ? objectCount.currentCold : 0; resTarget.objectCount.nonCurrentCold += objectCount && objectCount.nonCurrentCold ? objectCount.nonCurrentCold : 0; - resTarget.objectCount.restoring += objectCount && objectCount.restoring ? objectCount.restoring : 0; - resTarget.objectCount.restored += objectCount && objectCount.restored ? objectCount.restored : 0; + resTarget.objectCount.currentRestoring += objectCount && objectCount.currentRestoring ? objectCount.currentRestoring : 0; + resTarget.objectCount.currentRestored += objectCount && objectCount.currentRestored ? objectCount.currentRestored : 0; + resTarget.objectCount.nonCurrentRestoring += objectCount && objectCount.nonCurrentRestoring ? objectCount.nonCurrentRestoring : 0; + resTarget.objectCount.nonCurrentRestored += objectCount && objectCount.nonCurrentRestored ? objectCount.nonCurrentRestored : 0; return resTarget; } diff --git a/DataReport/collectBucketMetricsAndUpdateBucketCapacityInfo.js b/DataReport/collectBucketMetricsAndUpdateBucketCapacityInfo.js index 26602d21..c35beee4 100644 --- a/DataReport/collectBucketMetricsAndUpdateBucketCapacityInfo.js +++ b/DataReport/collectBucketMetricsAndUpdateBucketCapacityInfo.js @@ -39,8 +39,10 @@ function isValidBucketStorageMetrics(bucketMetric) { && bucketMetric.usedCapacity.nonCurrent > -1 && (typeof bucketMetric.usedCapacity.currentCold === 'undefined' || (bucketMetric.usedCapacity.currentCold > -1)) && (typeof bucketMetric.usedCapacity.nonCurrentCold === 'undefined' || (bucketMetric.usedCapacity.nonCurrentCold > -1)) - && (typeof bucketMetric.usedCapacity.restoring === 'undefined' || (bucketMetric.usedCapacity.restoring > -1)) - && (typeof bucketMetric.usedCapacity.restored === 'undefined' || (bucketMetric.usedCapacity.restored > -1)); + && (typeof bucketMetric.usedCapacity.currentRestoring === 'undefined' || (bucketMetric.usedCapacity.currentRestoring > -1)) + && (typeof bucketMetric.usedCapacity.currentRestored === 'undefined' || (bucketMetric.usedCapacity.currentRestored > -1)) + && (typeof bucketMetric.usedCapacity.nonCurrentRestoring === 'undefined' || (bucketMetric.usedCapacity.nonCurrentRestoring > -1)) + && (typeof bucketMetric.usedCapacity.nonCurrentRestored === 'undefined' || (bucketMetric.usedCapacity.nonCurrentRestored > -1)); } function isValidCapacityValue(capacity) { @@ -83,8 +85,10 @@ function collectBucketMetricsAndUpdateBucketCapacityInfo(mongoClient, log, callb // Do not count the objects in cold for SOSAPI bucketStorageUsed = storageMetricDoc.usedCapacity.current + storageMetricDoc.usedCapacity.nonCurrent - + (storageMetricDoc.usedCapacity.restoring || 0) - + (storageMetricDoc.usedCapacity.restored || 0); + + (storageMetricDoc.usedCapacity.currentRestoring || 0) + + (storageMetricDoc.usedCapacity.nonCurrentRestoring || 0) + + (storageMetricDoc.usedCapacity.currentRestored || 0) + + (storageMetricDoc.usedCapacity.nonCurrentRestored || 0); } // read Capacity from bucket._capabilities const { Capacity } = bucket.getCapabilities().VeeamSOSApi.CapacityInfo; diff --git a/tests/functional/utils/S3UtilsMongoClient.js b/tests/functional/utils/S3UtilsMongoClient.js index 9861cfa0..6ddefb46 100644 --- a/tests/functional/utils/S3UtilsMongoClient.js +++ b/tests/functional/utils/S3UtilsMongoClient.js @@ -149,16 +149,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -168,16 +172,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -191,16 +199,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -212,16 +224,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -291,16 +307,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -310,16 +330,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -333,16 +357,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -354,16 +382,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -428,16 +460,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -447,16 +483,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -470,16 +510,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -491,16 +535,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -573,16 +621,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -592,16 +644,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'completed': { @@ -611,16 +667,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -634,16 +694,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -655,16 +719,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'completed': { @@ -674,16 +742,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -770,16 +842,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -789,16 +865,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'completed': { @@ -808,16 +888,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -831,16 +915,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -852,16 +940,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'completed': { @@ -871,16 +963,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 10, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -994,16 +1090,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -1013,16 +1113,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1036,16 +1140,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1057,16 +1165,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { nonCurrent: 1, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1215,16 +1327,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 10, - restored: 0, - restoring: 10, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, 'us-east-1': { @@ -1234,16 +1350,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 10, - restoring: 10, + currentRestored: 10, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, }, @@ -1253,16 +1373,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 10, - restored: 10, - restoring: 10, + currentRestored: 10, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, }, @@ -1274,16 +1398,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 10, - restored: 10, - restoring: 10, + currentRestored: 10, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, }, @@ -1295,16 +1423,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 10, - restored: 0, - restoring: 10, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, 'us-east-1': { @@ -1314,16 +1446,20 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 1, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 10, - restoring: 10, + currentRestored: 10, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 10, }, }, }, diff --git a/tests/unit/CountItems/CountManager.js b/tests/unit/CountItems/CountManager.js index 4d0c5f8e..0e41879d 100644 --- a/tests/unit/CountItems/CountManager.js +++ b/tests/unit/CountItems/CountManager.js @@ -88,16 +88,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { location1: { @@ -107,16 +111,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -130,16 +138,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -151,16 +163,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -175,16 +191,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { location1: { @@ -194,16 +214,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -217,16 +241,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -238,16 +266,20 @@ describe('CountItems::CountManager', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 1, - restoring: 0, + currentRestored: 1, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 100, currentCold: 0, nonCurrentCold: 0, - restored: 100, - restoring: 0, + currentRestored: 100, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, diff --git a/tests/unit/CountItems/utils/utils.js b/tests/unit/CountItems/utils/utils.js index cfa6f2a2..4365e809 100644 --- a/tests/unit/CountItems/utils/utils.js +++ b/tests/unit/CountItems/utils/utils.js @@ -7,8 +7,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, objectCount: { current: 0, @@ -16,8 +18,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { deleteMarker: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }; @@ -27,8 +31,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, objectCount: { current: 10, @@ -36,8 +42,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { deleteMarker: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }; @@ -47,8 +55,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, objectCount: { current: 20, @@ -56,8 +66,10 @@ describe('CountItems::utils::consolidateDataMetrics', () => { deleteMarker: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }; diff --git a/tests/unit/utils/S3UtilsMongoClient.js b/tests/unit/utils/S3UtilsMongoClient.js index fb12f5bc..a3a30a61 100644 --- a/tests/unit/utils/S3UtilsMongoClient.js +++ b/tests/unit/utils/S3UtilsMongoClient.js @@ -133,16 +133,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 40, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -154,16 +158,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, location2: { @@ -173,16 +181,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -194,16 +206,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 40, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { location1: { @@ -213,16 +229,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, location2: { @@ -232,16 +252,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -273,16 +297,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 40, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -294,16 +322,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, location2: { @@ -313,16 +345,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -334,16 +370,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 40, nonCurrent: 20, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { location1: { @@ -353,16 +393,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, location2: { @@ -372,16 +416,20 @@ describe('S3UtilsMongoClient::_handleResults', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 20, nonCurrent: 10, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1064,16 +1112,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'rep-loc-1': { @@ -1083,16 +1135,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1102,16 +1158,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1125,16 +1185,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1146,16 +1210,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1165,16 +1233,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 200, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1229,16 +1301,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'us-east-1': { @@ -1248,16 +1324,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1271,16 +1351,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1292,16 +1376,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 200, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1376,16 +1464,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'rep-loc-1': { @@ -1395,16 +1487,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1414,16 +1510,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1437,16 +1537,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1458,16 +1562,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1477,16 +1585,20 @@ describe('S3UtilsMongoClient, tests', () => { nonCurrent: 2, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, nonCurrent: 300, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1582,16 +1694,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 1, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, currentCold: 100, nonCurrent: 100, nonCurrentCold: 100, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'rep-loc-1': { @@ -1601,16 +1717,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 100, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1620,16 +1740,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, currentCold: 0, nonCurrent: 100, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'cold-location': { @@ -1639,16 +1763,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 100, nonCurrent: 0, nonCurrentCold: 100, - restored: 0, - restoring: 100, + currentRestored: 0, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1662,16 +1790,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 1, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, currentCold: 100, nonCurrent: 100, nonCurrentCold: 100, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1683,16 +1815,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 100, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1702,16 +1838,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 1, nonCurrent: 1, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 100, currentCold: 0, nonCurrent: 100, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'cold-location': { @@ -1721,16 +1861,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 1, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 100, nonCurrent: 0, nonCurrentCold: 100, - restored: 0, - restoring: 100, + currentRestored: 0, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1784,16 +1928,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, locations: { 'cold-location': { @@ -1803,16 +1951,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 0, - restoring: 100, + currentRestored: 0, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'us-east-1': { @@ -1822,16 +1974,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1845,16 +2001,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, @@ -1866,16 +2026,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 1, - restoring: 1, + currentRestored: 1, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 100, - restoring: 100, + currentRestored: 100, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, 'cold-location': { @@ -1885,16 +2049,20 @@ describe('S3UtilsMongoClient, tests', () => { deleteMarker: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 0, - restoring: 1, + currentRestored: 0, + currentRestoring: 1, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, usedCapacity: { current: 0, currentCold: 0, nonCurrent: 0, nonCurrentCold: 0, - restored: 0, - restoring: 100, + currentRestored: 0, + currentRestoring: 100, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, }, }, diff --git a/utils/S3UtilsMongoClient.js b/utils/S3UtilsMongoClient.js index 87073e41..55254b8a 100644 --- a/utils/S3UtilsMongoClient.js +++ b/utils/S3UtilsMongoClient.js @@ -366,16 +366,20 @@ class S3UtilsMongoClient extends MongoClientInterface { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }, objectCount: { current: 0, nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restored: 0, - restoring: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, deleteMarker: 0, }, }; @@ -413,41 +417,41 @@ class S3UtilsMongoClient extends MongoClientInterface { dataMetrics[metricLevel][resourceName].usedCapacity.current += nullData + masterData; dataMetrics[metricLevel][resourceName].usedCapacity.currentCold += nullDataCold + masterDataCold; - dataMetrics[metricLevel][resourceName].usedCapacity.restoring += nullDataRestoring + masterDataRestoring; - dataMetrics[metricLevel][resourceName].usedCapacity.restored += nullDataRestored + masterDataRestored; + dataMetrics[metricLevel][resourceName].usedCapacity.currentRestoring += nullDataRestoring + masterDataRestoring; + dataMetrics[metricLevel][resourceName].usedCapacity.currentRestored += nullDataRestored + masterDataRestored; dataMetrics[metricLevel][resourceName].objectCount.current += nullCount + masterCount; dataMetrics[metricLevel][resourceName].objectCount.currentCold += nullCountCold + masterCountCold; - dataMetrics[metricLevel][resourceName].objectCount.restoring += nullCountRestoring + masterCountRestoring; - dataMetrics[metricLevel][resourceName].objectCount.restored += nullCountRestored + masterCountRestored; + dataMetrics[metricLevel][resourceName].objectCount.currentRestoring += nullCountRestoring + masterCountRestoring; + dataMetrics[metricLevel][resourceName].objectCount.currentRestored += nullCountRestored + masterCountRestored; if (isVersioned) { dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent += versionData - masterData; // masterData is duplicated in versionedData dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentCold += versionDataCold - masterDataCold; - dataMetrics[metricLevel][resourceName].usedCapacity.restoring + dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestoring += versionDataRestoring - masterDataRestoring; - dataMetrics[metricLevel][resourceName].usedCapacity.restored + dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestored += versionDataRestored - masterDataRestored; dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent, 0); dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentCold = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentCold, 0); - dataMetrics[metricLevel][resourceName].usedCapacity.restoring = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.restoring, 0); - dataMetrics[metricLevel][resourceName].usedCapacity.restored = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.restored, 0); + dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestoring = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestoring, 0); + dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestored = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrentRestored, 0); dataMetrics[metricLevel][resourceName].objectCount.nonCurrent += versionCount - masterCount - deleteMarkerCount; dataMetrics[metricLevel][resourceName].objectCount.nonCurrentCold += versionCountCold - masterCountCold; - dataMetrics[metricLevel][resourceName].objectCount.restoring + dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestoring += versionCountRestoring - masterCountRestoring; - dataMetrics[metricLevel][resourceName].objectCount.restored + dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestored += versionCountRestored - masterCountRestored; dataMetrics[metricLevel][resourceName].objectCount.nonCurrent = Math.max(dataMetrics[metricLevel][resourceName].objectCount.nonCurrent, 0); dataMetrics[metricLevel][resourceName].objectCount.nonCurrentCold = Math.max(dataMetrics[metricLevel][resourceName].objectCount.nonCurrentCold, 0); - dataMetrics[metricLevel][resourceName].objectCount.restoring = Math.max(dataMetrics[metricLevel][resourceName].objectCount.restoring, 0); - dataMetrics[metricLevel][resourceName].objectCount.restored = Math.max(dataMetrics[metricLevel][resourceName].objectCount.restored, 0); + dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestoring = Math.max(dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestoring, 0); + dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestored = Math.max(dataMetrics[metricLevel][resourceName].objectCount.nonCurrentRestored, 0); dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCount; dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCountCold; @@ -501,8 +505,10 @@ class S3UtilsMongoClient extends MongoClientInterface { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restoring: 0, - restored: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, }; } if (!accountLocation.objectCount) { @@ -511,8 +517,10 @@ class S3UtilsMongoClient extends MongoClientInterface { nonCurrent: 0, currentCold: 0, nonCurrentCold: 0, - restoring: 0, - restored: 0, + currentRestored: 0, + currentRestoring: 0, + nonCurrentRestored: 0, + nonCurrentRestoring: 0, deleteMarker: 0, }; } @@ -520,15 +528,19 @@ class S3UtilsMongoClient extends MongoClientInterface { accountLocation.usedCapacity.nonCurrent += dataMetrics.location[location].usedCapacity.nonCurrent; accountLocation.usedCapacity.currentCold += dataMetrics.location[location].usedCapacity.currentCold; accountLocation.usedCapacity.nonCurrentCold += dataMetrics.location[location].usedCapacity.nonCurrentCold; - accountLocation.usedCapacity.restoring += dataMetrics.location[location].usedCapacity.restoring; - accountLocation.usedCapacity.restored += dataMetrics.location[location].usedCapacity.restored; + accountLocation.usedCapacity.currentRestoring += dataMetrics.location[location].usedCapacity.currentRestoring; + accountLocation.usedCapacity.nonCurrentRestoring += dataMetrics.location[location].usedCapacity.nonCurrentRestoring; + accountLocation.usedCapacity.currentRestored += dataMetrics.location[location].usedCapacity.currentRestored; + accountLocation.usedCapacity.nonCurrentRestored += dataMetrics.location[location].usedCapacity.nonCurrentRestored; accountLocation.objectCount.current += dataMetrics.location[location].objectCount.current; accountLocation.objectCount.nonCurrent += dataMetrics.location[location].objectCount.nonCurrent; accountLocation.objectCount.currentCold += dataMetrics.location[location].objectCount.currentCold; accountLocation.objectCount.nonCurrentCold += dataMetrics.location[location].objectCount.nonCurrentCold; - accountLocation.objectCount.restoring += dataMetrics.location[location].objectCount.restoring; - accountLocation.objectCount.restored += dataMetrics.location[location].objectCount.restored; + accountLocation.objectCount.currentRestoring += dataMetrics.location[location].objectCount.currentRestoring; + accountLocation.objectCount.nonCurrentRestoring += dataMetrics.location[location].objectCount.nonCurrentRestoring; + accountLocation.objectCount.currentRestored += dataMetrics.location[location].objectCount.currentRestored; + accountLocation.objectCount.nonCurrentRestored += dataMetrics.location[location].objectCount.nonCurrentRestored; accountLocation.objectCount.deleteMarker += dataMetrics.location[location].objectCount.deleteMarker; });