Compare commits

...

3 Commits

Author SHA1 Message Date
williamlardier 6b5139ebaa
ARSN-345: fixups 2023-06-08 11:16:12 +02:00
williamlardier a48efc0f8b
ARSN-345: fixups 2023-06-08 09:08:01 +02:00
williamlardier 5b30e80c80
ARSN-345: linting 2023-06-07 18:44:42 +02:00
1 changed files with 19 additions and 6 deletions

View File

@ -1045,9 +1045,13 @@ class MongoClientInterface {
const c = this.getCollection(bucketName); const c = this.getCollection(bucketName);
let vFormat = null; let vFormat = null;
// Function to process each document // Function to process each document
const processDoc = (doc, objName, params, cb) => { const processDoc = (doc, objName, params, key, cb) => {
if (!doc && params && params.versionId) { if (!doc && params && params.versionId) {
return cb(errors.NoSuchKey); return cb(null, {
doc: null,
versionId: params.versionId,
key,
});
} }
// If no master found then object is either non existent // If no master found then object is either non existent
// or last version is delete marker // or last version is delete marker
@ -1056,11 +1060,19 @@ class MongoClientInterface {
if (err && !err.is.NoSuchKey) { if (err && !err.is.NoSuchKey) {
return cb(err); return cb(err);
} }
return cb(null, doc || null); return cb(null, {
doc: doc || null,
versionId: params.versionId,
key,
});
}); });
} }
MongoUtils.unserialize(doc.value); MongoUtils.unserialize(doc.value);
return cb(null, doc.value); return cb(null, {
doc: doc.value,
versionId: params.versionId,
key,
});
}; };
this.getBucketVFormat(bucketName, log, (err, _vFormat) => { this.getBucketVFormat(bucketName, log, (err, _vFormat) => {
if (err) { if (err) {
@ -1088,7 +1100,7 @@ class MongoClientInterface {
// Process each document using associated context (objName, params) // Process each document using associated context (objName, params)
async.mapLimit(keysAndObjects, 5, ({ key, objName, params }, cb) => { async.mapLimit(keysAndObjects, 5, ({ key, objName, params }, cb) => {
const doc = docByKey.get(key); const doc = docByKey.get(key);
processDoc(doc, objName, params, cb); processDoc(doc, objName, params, key, cb);
}, callback); }, callback);
}).catch(err => { }).catch(err => {
callback(err); callback(err);
@ -1483,7 +1495,8 @@ class MongoClientInterface {
* @param {object} [params] request params * @param {object} [params] request params
* @return {undefined} * @return {undefined}
*/ */
internalDeleteObject(collection, bucketName, key, filter, log, cb, originOp = 's3:ObjectRemoved:Delete', params = null) { internalDeleteObject(collection, bucketName, key, filter, log, cb, originOp = 's3:ObjectRemoved:Delete',
params = null) {
// filter used when deleting object // filter used when deleting object
const deleteFilter = Object.assign({ const deleteFilter = Object.assign({
_id: key, _id: key,