Compare commits
5 Commits
developmen
...
exp/perfMe
Author | SHA1 | Date |
---|---|---|
Anurag Mittal | fff956b02b | |
Anurag Mittal | 2c0d6c9c13 | |
Anurag Mittal | bf84e8b525 | |
Anurag Mittal | a8e585c2e6 | |
Anurag Mittal | 1bcf735e3d |
|
@ -228,6 +228,8 @@ class MongoClientInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
getBucketAttributes(bucketName, log, cb) {
|
getBucketAttributes(bucketName, log, cb) {
|
||||||
|
log.debug('entered getBucketAttributes',
|
||||||
|
{ database: bucketName });
|
||||||
const m = this.getCollection(METASTORE);
|
const m = this.getCollection(METASTORE);
|
||||||
m.findOne({
|
m.findOne({
|
||||||
_id: bucketName,
|
_id: bucketName,
|
||||||
|
@ -245,11 +247,15 @@ class MongoClientInterface {
|
||||||
// that properly inits w/o JSON.parse()
|
// that properly inits w/o JSON.parse()
|
||||||
const bucketMDStr = JSON.stringify(doc.value);
|
const bucketMDStr = JSON.stringify(doc.value);
|
||||||
const bucketMD = BucketInfo.deSerialize(bucketMDStr);
|
const bucketMD = BucketInfo.deSerialize(bucketMDStr);
|
||||||
|
log.debug('exiting getBucketAttributes',
|
||||||
|
{ database: bucketName });
|
||||||
return cb(null, bucketMD);
|
return cb(null, bucketMD);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBucketAndObject(bucketName, objName, params, log, cb) {
|
getBucketAndObject(bucketName, objName, params, log, cb) {
|
||||||
|
log.debug('entered getBucketAndObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
this.getBucketAttributes(bucketName, log, (err, bucket) => {
|
this.getBucketAttributes(bucketName, log, (err, bucket) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error(
|
log.error(
|
||||||
|
@ -260,8 +266,11 @@ class MongoClientInterface {
|
||||||
this.getObject(bucketName, objName, params, log, (err, obj) => {
|
this.getObject(bucketName, objName, params, log, (err, obj) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err === errors.NoSuchKey) {
|
if (err === errors.NoSuchKey) {
|
||||||
|
log.debug('exiting getBucketAndObject with no such key',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return cb(null,
|
return cb(null,
|
||||||
{ bucket:
|
{
|
||||||
|
bucket:
|
||||||
BucketInfo.fromObj(bucket).serialize(),
|
BucketInfo.fromObj(bucket).serialize(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -269,6 +278,8 @@ class MongoClientInterface {
|
||||||
{ error: err.message });
|
{ error: err.message });
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
log.debug('exiting getBucketAndObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return cb(null, {
|
return cb(null, {
|
||||||
bucket: BucketInfo.fromObj(bucket).serialize(),
|
bucket: BucketInfo.fromObj(bucket).serialize(),
|
||||||
obj: JSON.stringify(obj),
|
obj: JSON.stringify(obj),
|
||||||
|
@ -618,26 +629,44 @@ class MongoClientInterface {
|
||||||
|
|
||||||
putObject(bucketName, objName, objVal, params, log, cb) {
|
putObject(bucketName, objName, objVal, params, log, cb) {
|
||||||
MongoUtils.serialize(objVal);
|
MongoUtils.serialize(objVal);
|
||||||
|
log.debug('entered putObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
const c = this.getCollection(bucketName);
|
const c = this.getCollection(bucketName);
|
||||||
|
log.debug('inside putObject, got the collection name',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
if (params && params.versioning && !params.versionId) {
|
if (params && params.versioning && !params.versionId) {
|
||||||
|
log.debug('inside putObject, case: putObjectVerCase1',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return this.putObjectVerCase1(c, bucketName, objName, objVal,
|
return this.putObjectVerCase1(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
} else if (params && params.versionId === '') {
|
} else if (params && params.versionId === '') {
|
||||||
|
log.debug('inside putObject, case: putObjectVerCase2',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return this.putObjectVerCase2(c, bucketName, objName, objVal,
|
return this.putObjectVerCase2(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
} else if (params && params.versionId && !params.repairMaster) {
|
} else if (params && params.versionId && !params.repairMaster) {
|
||||||
|
log.debug('inside putObject, case: putObjectVerCase3',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return this.putObjectVerCase3(c, bucketName, objName, objVal,
|
return this.putObjectVerCase3(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
} else if (params && params.versionId && params.repairMaster) {
|
} else if (params && params.versionId && params.repairMaster) {
|
||||||
|
log.debug('inside putObject, case: putObjectVerCase4',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return this.putObjectVerCase4(c, bucketName, objName, objVal,
|
return this.putObjectVerCase4(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
}
|
}
|
||||||
|
log.debug('inside putObject, case: noversion',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return this.putObjectNoVer(c, bucketName, objName, objVal,
|
return this.putObjectNoVer(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
getObject(bucketName, objName, params, log, cb) {
|
getObject(bucketName, objName, params, log, cb) {
|
||||||
|
log.debug('entered getObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
const c = this.getCollection(bucketName);
|
const c = this.getCollection(bucketName);
|
||||||
|
log.debug('inside getObject, got the collection',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
if (params && params.versionId) {
|
if (params && params.versionId) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
objName = formatVersionKey(objName, params.versionId);
|
objName = formatVersionKey(objName, params.versionId);
|
||||||
|
@ -645,12 +674,17 @@ class MongoClientInterface {
|
||||||
c.findOne({
|
c.findOne({
|
||||||
_id: objName,
|
_id: objName,
|
||||||
}, {}, (err, doc) => {
|
}, {}, (err, doc) => {
|
||||||
|
log.debug('inside getObject, inside the cb for findOne query',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('findOne: error getting object',
|
log.error('findOne: error getting object',
|
||||||
{ error: err.message });
|
{ error: err.message });
|
||||||
return cb(errors.InternalError);
|
return cb(errors.InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
|
log.debug('inside getObject, got reply from database, obj not found',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return cb(errors.NoSuchKey);
|
return cb(errors.NoSuchKey);
|
||||||
}
|
}
|
||||||
if (doc.value.isPHD) {
|
if (doc.value.isPHD) {
|
||||||
|
@ -660,11 +694,15 @@ class MongoClientInterface {
|
||||||
{ error: err.message });
|
{ error: err.message });
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
log.debug('exited in PHD getObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return cb(null, value);
|
return cb(null, value);
|
||||||
});
|
});
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
MongoUtils.unserialize(doc.value);
|
MongoUtils.unserialize(doc.value);
|
||||||
|
log.debug('exited getObject',
|
||||||
|
{ database: bucketName, object: objName });
|
||||||
return cb(null, doc.value);
|
return cb(null, doc.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue