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

Function startRestore

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

* start to restore object. * If not exist x-amz-restore, add it to objectMD.(x-amz-restore = false) * calculate restore expiry-date and add it to objectMD. * Be called by objectRestore.js * * @param {ObjectMD} objectMD - objectMd instance * @param {object} restoreParam - bucket name * @param

(objectMD, restoreParam, log, cb)

Source from the content-addressed store, hash-verified

244 *
245 */
246function startRestore(objectMD, restoreParam, log, cb) {
247 log.debug('Validating if restore can be done or not.');
248 const checkResultError = _validateStartRestore(objectMD, log);
249 if (checkResultError) {
250 log.debug('Restore cannot be done.', {
251 error: checkResultError,
252 method: 'startRestore'
253 });
254 return cb(checkResultError);
255 }
256 const updateResultError = _updateRestoreInfo(objectMD, restoreParam, log);
257 if (updateResultError) {
258 log.debug('Failed to update restore information.', {
259 error: updateResultError,
260 method: 'startRestore'
261 });
262 return cb(updateResultError);
263 }
264 log.debug('Validated and updated restore information', {
265 method: 'startRestore'
266 });
267 const isObjectAlreadyRestored = _updateObjectExpirationDate(objectMD, log);
268 return cb(null, isObjectAlreadyRestored);
269}
270
271/**
272 * checks if object data is available or if it's in cold storage

Callers 1

coldStorage.jsFile · 0.85

Calls 4

_validateStartRestoreFunction · 0.85
_updateRestoreInfoFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected