Compare commits
2 Commits
developmen
...
wip/ingest
Author | SHA1 | Date |
---|---|---|
philipyoo | 82be4bd3e6 | |
philipyoo | c685c62a5e |
|
@ -112,4 +112,6 @@ module.exports = {
|
||||||
clientsRequireStringKey: { sproxyd: true, cdmi: true },
|
clientsRequireStringKey: { sproxyd: true, cdmi: true },
|
||||||
hasCopyPartBackends: { aws_s3: true, gcp: true },
|
hasCopyPartBackends: { aws_s3: true, gcp: true },
|
||||||
versioningNotImplBackends: { azure: true, gcp: true },
|
versioningNotImplBackends: { azure: true, gcp: true },
|
||||||
|
// user metadata applied on zenko-created objects
|
||||||
|
zenkoIDHeader: 'x-amz-meta-zenko-instance-id',
|
||||||
};
|
};
|
||||||
|
|
|
@ -508,6 +508,55 @@ class MongoClientInterface {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In this case the caller provides a versionId and a flag called usePHD.
|
||||||
|
* This function will save the versionId object as is and will set PHD on
|
||||||
|
* master. If a user performs any operation to find IsLatest, the PHD flag
|
||||||
|
* indicates to perform a search on the bucket to find the latest version.
|
||||||
|
* We rely on the natural ordering of versions for listings. We rely on
|
||||||
|
* internal MongoClientInterface operations for master version and repairs.
|
||||||
|
*/
|
||||||
|
putObjectVerCase4(c, bucketName, objName, objVal, params, log, cb) {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
objVal.versionId = params.versionId;
|
||||||
|
const vObjName = formatVersionKey(objName, params.versionId);
|
||||||
|
const mst = generatePHDVersion(params.versionId);
|
||||||
|
return c.bulkWrite([{
|
||||||
|
updateOne: {
|
||||||
|
filter: {
|
||||||
|
_id: vObjName,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
$set: {
|
||||||
|
_id: vObjName,
|
||||||
|
value: objVal,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
upsert: true,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
updateOne: {
|
||||||
|
filter: {
|
||||||
|
_id: objName,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
_id: objName, value: mst,
|
||||||
|
},
|
||||||
|
upsert: true,
|
||||||
|
},
|
||||||
|
}], {
|
||||||
|
ordered: 1,
|
||||||
|
}, err => {
|
||||||
|
if (err) {
|
||||||
|
log.error('putObjectVerCase4: error putting object version', {
|
||||||
|
error: err.message,
|
||||||
|
});
|
||||||
|
return cb(errors.InternalError);
|
||||||
|
}
|
||||||
|
return cb(null, `{"versionId": "${objVal.versionId}"}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put object when versioning is not enabled
|
* Put object when versioning is not enabled
|
||||||
*/
|
*/
|
||||||
|
@ -539,9 +588,12 @@ class MongoClientInterface {
|
||||||
} else if (params && params.versionId === '') {
|
} else if (params && params.versionId === '') {
|
||||||
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) {
|
} else if (params && params.versionId && !params.usePHD) {
|
||||||
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.usePHD) {
|
||||||
|
return this.putObjectVerCase4(c, bucketName, objName, objVal,
|
||||||
|
params, log, cb);
|
||||||
}
|
}
|
||||||
return this.putObjectNoVer(c, bucketName, objName, objVal,
|
return this.putObjectNoVer(c, bucketName, objName, objVal,
|
||||||
params, log, cb);
|
params, log, cb);
|
||||||
|
|
Loading…
Reference in New Issue