Compare commits

...

6 Commits

Author SHA1 Message Date
Nicolas Humbert 4c3098c13e add multi-backend constants 2022-04-25 14:35:26 -04:00
Ronnie Smith 7f29e03e4a
add missing is 2022-04-22 10:56:35 -07:00
Ronnie Smith 3c6742b607
add missing is 2022-04-21 15:28:21 -07:00
Ronnie Smith 1f1fd401c1
[skip] add is to rpc errors, bucket file interface setup 2022-04-21 12:43:44 -07:00
Ronnie Smith dab7f54dc5
Merge branch 'development/7.10' into feature/ARSN-150/export-http-utils-for-cloudserver 2022-04-21 11:54:18 -07:00
Ronnie Smith d6fcbdb4f6
feature: ARSN-150 export http utils for cloudserver 2022-04-18 09:01:34 -07:00
4 changed files with 17 additions and 16 deletions

View File

@ -74,6 +74,9 @@ module.exports = {
},
/* eslint-disable camelcase */
externalBackends: { aws_s3: true, azure: true, gcp: true, pfs: true },
hasCopyPartBackends: { aws_s3: true, gcp: true },
versioningNotImplBackends: { azure: true, gcp: true },
mpuMDStoredExternallyBackend: { aws_s3: true, gcp: true },
/* eslint-enable camelcase */
// Default expiration value of the S3 pre-signed URL duration
// 604800 seconds (seven days).

View File

@ -40,7 +40,9 @@ module.exports.reconstructError = function reconstructError(err) {
return err;
}
const reconstructedErr = new Error(err.message);
reconstructedErr.is = {
[err.message]: true,
};
Object.keys(err).forEach(k => {
reconstructedErr[k] = err[k];
});

View File

@ -146,7 +146,7 @@ class DataWrapper {
return;
}
this._retryDelete(clientGetInfo, log, 0, err => {
if (err && !err.ObjNotFound) {
if (err && !err.is.ObjNotFound) {
log.error('delete error from datastore',
{ error: err, key: objectGetInfo.key, moreRetries: 'no' });
}
@ -984,7 +984,7 @@ class DataWrapper {
return this.client.delete(objectGetInfo, log.getSerializedUids(),
err => {
if (err) {
if (err.ObjNotFound) {
if (err.is.ObjNotFound) {
log.info('no such key in datastore', {
objectGetInfo,
implName: this.implName,

View File

@ -1,4 +1,3 @@
const cluster = require('cluster');
const async = require('async');
const errors = require('../../../errors').default;
@ -20,7 +19,6 @@ class BucketFileInterface {
/**
* @constructor
* @param {object} [params] - constructor params
* @param {boolean} [params.noDbOpen=false] - true to skip DB open
* @param {object} logger - logger
* (for unit tests only)
*/
@ -29,9 +27,6 @@ class BucketFileInterface {
const { host, port } = params.metadataClient;
this.constants = params.constants;
this.mdClient = new MetadataFileClient({ host, port });
if (params && params.noDbOpen) {
return;
}
this.lastItemScanTime = null;
this.lastItemScanResult = null;
}
@ -44,16 +39,17 @@ class BucketFileInterface {
// the metastore sublevel is used to store bucket attributes
this.mdDB = value;
this.metastore = this.mdDB.openSub(METASTORE);
if (cluster.isMaster) {
this.setupMetadataServer(done);
}
this.setupMetadataServer(done);
});
}
setupMetadataServer(done) {
/* Since the bucket creation API is expecting the
usersBucket to have attributes, we pre-create the
usersBucket attributes here */
usersBucket attributes here.
This call is idempotent so we are ok calling it many times
when using multiple workers.
*/
this.mdClient.logger.debug('setting up metadata server');
const usersBucketAttr = new BucketInfo(this.constants.usersBucket,
'admin', 'admin', new Date().toJSON(),
@ -95,7 +91,7 @@ class BucketFileInterface {
createBucket(bucketName, bucketMD, log, cb) {
this.getBucketAttributes(bucketName, log, err => {
if (err && err !== errors.NoSuchBucket) {
if (err && !err.is.NoSuchBucket) {
return cb(err);
}
if (err === undefined) {
@ -114,7 +110,7 @@ class BucketFileInterface {
.withRequestLogger(log)
.get(bucketName, {}, (err, data) => {
if (err) {
if (err.ObjNotFound) {
if (err.is.ObjNotFound) {
return cb(errors.NoSuchBucket);
}
const logObj = {
@ -138,7 +134,7 @@ class BucketFileInterface {
db.withRequestLogger(log)
.get(objName, params, (err, objAttr) => {
if (err) {
if (err.ObjNotFound) {
if (err.is.ObjNotFound) {
return cb(null, {
bucket: bucketAttr.serialize(),
});
@ -232,7 +228,7 @@ class BucketFileInterface {
}
db.withRequestLogger(log).get(objName, params, (err, data) => {
if (err) {
if (err.ObjNotFound) {
if (err.is.ObjNotFound) {
return cb(errors.NoSuchKey);
}
const logObj = {