Compare commits

...

1 Commits

Author SHA1 Message Date
Nicolas Humbert c0f6aa0f23 dataStoreName 2023-03-31 15:46:05 -04:00
4 changed files with 51 additions and 25 deletions

View File

@ -22,13 +22,14 @@ function handleResult(listParams, requestMaxKeys, authInfo,
* listLifecycleCurrents - Return list of current versions/masters in bucket
* @param {AuthInfo} authInfo - Instance of AuthInfo class with
* requester's info
* @param {array} locationConstraints - array of location contraint
* @param {object} request - http request object
* @param {function} log - Werelogs request logger
* @param {function} callback - callback to respond to http request
* with either error code or xml response body
* @return {undefined}
*/
function listLifecycleCurrents(authInfo, request, log, callback) {
function listLifecycleCurrents(authInfo, locationConstraints, request, log, callback) {
const params = request.query;
const bucketName = request.bucketName;
@ -37,11 +38,21 @@ function listLifecycleCurrents(authInfo, request, log, callback) {
Number.parseInt(params['max-keys'], 10) : 1000;
if (Number.isNaN(requestMaxKeys) || requestMaxKeys < 0) {
monitoring.promMetrics(
'GET', bucketName, 400, 'listBucket');
'GET', bucketName, 400, 'listLifecycleCurrents');
return callback(errors.InvalidArgument);
}
const actualMaxKeys = Math.min(constants.listingHardLimit, requestMaxKeys);
const excludedDataStoreName = params['excluded-data-store-name'];
if (excludedDataStoreName && !locationConstraints[excludedDataStoreName]) {
const errMsg = 'value of the location you are attempting to set - ' +
`${excludedDataStoreName} - is not listed in the ` +
'locationConstraint config';
log.error(`locationConstraint is invalid - ${errMsg}`, { locationConstraint: excludedDataStoreName });
monitoring.promMetrics('GET', bucketName, 400, 'listLifecycleCurrents');
return callback(errors.InvalidLocationConstraint.customizeDescription(errMsg));
}
const metadataValParams = {
authInfo,
bucketName,
@ -54,6 +65,7 @@ function listLifecycleCurrents(authInfo, request, log, callback) {
prefix: params.prefix,
beforeDate: params['before-date'],
marker: params.marker,
excludedDataStoreName,
};
return metadataValidateBucket(metadataValParams, log, err => {

View File

@ -22,13 +22,14 @@ function handleResult(listParams, requestMaxKeys, authInfo,
* listLifecycleNonCurrents - Return list of non-current versions in bucket
* @param {AuthInfo} authInfo - Instance of AuthInfo class with
* requester's info
* @param {array} locationConstraints - array of location contraint
* @param {object} request - http request object
* @param {function} log - Werelogs request logger
* @param {function} callback - callback to respond to http request
* with either error code or xml response body
* @return {undefined}
*/
function listLifecycleNonCurrents(authInfo, request, log, callback) {
function listLifecycleNonCurrents(authInfo, locationConstraints, request, log, callback) {
const params = request.query;
const bucketName = request.bucketName;
@ -37,11 +38,21 @@ function listLifecycleNonCurrents(authInfo, request, log, callback) {
Number.parseInt(params['max-keys'], 10) : 1000;
if (Number.isNaN(requestMaxKeys) || requestMaxKeys < 0) {
monitoring.promMetrics(
'GET', bucketName, 400, 'listBucket');
'GET', bucketName, 400, 'listLifecycleNonCurrents');
return callback(errors.InvalidArgument);
}
const actualMaxKeys = Math.min(constants.listingHardLimit, requestMaxKeys);
const excludedDataStoreName = params['excluded-data-store-name'];
if (excludedDataStoreName && !locationConstraints[excludedDataStoreName]) {
const errMsg = 'value of the location you are attempting to set - ' +
`${excludedDataStoreName} - is not listed in the ` +
'locationConstraint config';
log.error(`locationConstraint is invalid - ${errMsg}`, { locationConstraint: excludedDataStoreName });
monitoring.promMetrics('GET', bucketName, 400, 'listLifecycleCurrents');
return callback(errors.InvalidLocationConstraint.customizeDescription(errMsg));
}
const metadataValParams = {
authInfo,
bucketName,
@ -54,6 +65,7 @@ function listLifecycleNonCurrents(authInfo, request, log, callback) {
prefix: params.prefix,
beforeDate: params['before-date'],
keyMarker: params['key-marker'],
excludedDataStoreName,
};
listParams.versionIdMarker = params['version-id-marker'] ?

View File

@ -21,13 +21,14 @@ function handleResult(listParams, requestMaxKeys, authInfo,
* listLifecycleOrphanDeleteMarkers - Return list of expired object delete marker in bucket
* @param {AuthInfo} authInfo - Instance of AuthInfo class with
* requester's info
* @param {array} locationConstraints - array of location contraint
* @param {object} request - http request object
* @param {function} log - Werelogs request logger
* @param {function} callback - callback to respond to http request
* with either error code or xml response body
* @return {undefined}
*/
function listLifecycleOrphanDeleteMarkers(authInfo, request, log, callback) {
function listLifecycleOrphanDeleteMarkers(authInfo, locationConstraints, request, log, callback) {
const params = request.query;
const bucketName = request.bucketName;
@ -36,7 +37,7 @@ function listLifecycleOrphanDeleteMarkers(authInfo, request, log, callback) {
Number.parseInt(params['max-keys'], 10) : 1000;
if (Number.isNaN(requestMaxKeys) || requestMaxKeys < 0) {
monitoring.promMetrics(
'GET', bucketName, 400, 'listBucket');
'GET', bucketName, 400, 'listLifecycleOrphanDeleteMarkers');
return callback(errors.InvalidArgument);
}
const actualMaxKeys = Math.min(constants.listingHardLimit, requestMaxKeys);

View File

@ -505,6 +505,7 @@ function putMetadata(request, response, bucketInfo, objMd, log, callback) {
}
log.trace('putting object version', {
objectKey: request.objectKey, omVal, options });
console.log('bucketName, objectKey, omVal, options!!!', bucketName, objectKey, omVal, options);
return metadata.putObjectMD(bucketName, objectKey, omVal, options, log,
(err, md) => {
if (err) {
@ -1105,7 +1106,7 @@ function listLifecycle(request, response, userInfo, log, cb) {
return cb(errors.BadRequest.customizeDescription(errMessage));
}
return call(userInfo, request, log, (err, data) => {
return call(userInfo, locationConstraints, request, log, (err, data) => {
if (err) {
log.error(`error during listing objects for lifecycle: ${listType}`, {
error: err,