MCPcopy Index your code
hub / github.com/scality/cloudserver / verifyColdObjectAvailable

Function verifyColdObjectAvailable

lib/api/apiUtils/object/coldStorage.js:276–288  ·  view source on GitHub ↗

* checks if object data is available or if it's in cold storage * @param {ObjectMD} objMD Object metadata * @returns {ArsenalError|null} error if object data is not available

(objMD)

Source from the content-addressed store, hash-verified

274 * @returns {ArsenalError|null} error if object data is not available
275 */
276function verifyColdObjectAvailable(objMD) {
277 // return error when object is cold
278 if (objMD.archive &&
279 // Object is in cold backend
280 (!objMD.archive.restoreRequestedAt ||
281 // Object is being restored
282 (objMD.archive.restoreRequestedAt && !objMD.archive.restoreCompletedAt))) {
283 const err = errorInstances.InvalidObjectState
284 .customizeDescription('The operation is not valid for the object\'s storage class');
285 return err;
286 }
287 return null;
288}
289
290module.exports = {
291 startRestore,

Callers 4

objectGetFunction · 0.85
objectCopyFunction · 0.85
objectPutCopyPartFunction · 0.85
coldStorage.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected