Compare commits
2 Commits
developmen
...
bugfix/ARS
Author | SHA1 | Date |
---|---|---|
williamlardier | b759691160 | |
williamlardier | 31b88cc9e6 |
|
@ -147,6 +147,40 @@ class MetadataWrapper {
|
|||
});
|
||||
}
|
||||
|
||||
updateBucketCapabilities(bucketName, capabilityName, capability, log, cb) {
|
||||
log.debug('updating bucket capabilities in metadata');
|
||||
if (!this.client.putBucketAttributesCapabilities) {
|
||||
return cb(errors.NotImplemented);
|
||||
}
|
||||
return this.client.putBucketAttributesCapabilities(bucketName, capabilityName, capability,
|
||||
log, err => {
|
||||
if (err) {
|
||||
log.debug('error from metadata', { implName: this.implName,
|
||||
error: err });
|
||||
return cb(err);
|
||||
}
|
||||
log.trace('bucket capabilities updated in metadata');
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
|
||||
deleteBucketCapabilities(bucketName, capabilityName, log, cb) {
|
||||
log.debug('deleting bucket capabilities in metadata');
|
||||
if (!this.client.deleteBucketAttributesCapability) {
|
||||
return cb(errors.NotImplemented);
|
||||
}
|
||||
return this.client.deleteBucketAttributesCapability(bucketName, capabilityName,
|
||||
log, err => {
|
||||
if (err) {
|
||||
log.debug('error from metadata', { implName: this.implName,
|
||||
error: err });
|
||||
return cb(err);
|
||||
}
|
||||
log.trace('bucket capabilities deleted in metadata');
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
|
||||
getBucket(bucketName, log, cb) {
|
||||
log.debug('getting bucket from metadata');
|
||||
this.client.getBucketAttributes(bucketName, log, (err, data) => {
|
||||
|
|
|
@ -412,6 +412,64 @@ class MongoClientInterface {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} bucketName - name of bucket
|
||||
* @param {String} capabilityName - name of capability
|
||||
* @param {Object} capability - capability object
|
||||
* @param {Sbject} log - logger
|
||||
* @param {Function} cb - callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
putBucketAttributesCapabilities(bucketName, capabilityName, capability, log, cb) {
|
||||
const m = this.getCollection(METASTORE);
|
||||
m.update({
|
||||
_id: bucketName,
|
||||
}, {
|
||||
$set: {
|
||||
_id: bucketName,
|
||||
[`value.capabilities.${capabilityName}`]: capability,
|
||||
},
|
||||
}, {
|
||||
upsert: true,
|
||||
}, err => {
|
||||
if (err) {
|
||||
log.error(
|
||||
'putBucketAttributesCapabilities: error putting bucket attributes',
|
||||
{ error: err.message });
|
||||
return cb(errors.InternalError);
|
||||
}
|
||||
return cb();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete bucket attributes capability
|
||||
* @param {String} bucketName - name of bucket
|
||||
* @param {String} capabilityName - name of capability
|
||||
* @param {Object} log - logger
|
||||
* @param {Function} cb - callback
|
||||
* @return {undefined}
|
||||
**/
|
||||
deleteBucketAttributesCapability(bucketName, capabilityName, log, cb) {
|
||||
const m = this.getCollection(METASTORE);
|
||||
m.update({
|
||||
_id: bucketName,
|
||||
}, {
|
||||
$unset: {
|
||||
[`value.capabilities.${capabilityName}`]: '',
|
||||
},
|
||||
}, err => {
|
||||
if (err) {
|
||||
log.error(
|
||||
'deleteBucketAttributesCapability: error deleting bucket attributes',
|
||||
{ error: err.message });
|
||||
return cb(errors.InternalError);
|
||||
}
|
||||
return cb();
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete bucket from metastore
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue