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

Function _updateRestoreInfo

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

* update restore expiration date. * * @param {ObjectMD} objectMD - objectMD instance * @param {object} restoreParam - restore param * @param {object} log - werelogs logger * @return {ArsenalError|undefined} internal error if object MD is not valid *

(objectMD, restoreParam, log)

Source from the content-addressed store, hash-verified

208 *
209 */
210function _updateRestoreInfo(objectMD, restoreParam, log) {
211 if (!objectMD.archive) {
212 log.debug('objectMD.archive doesn\'t exits', {
213 objectMD,
214 method: '_updateRestoreInfo'
215 });
216 return errorInstances.InternalError.customizeDescription('Archive metadata is missing.');
217 }
218 /* eslint-disable no-param-reassign */
219 objectMD.archive.restoreRequestedAt = new Date();
220 objectMD.archive.restoreRequestedDays = restoreParam.days;
221 objectMD.originOp = 's3:ObjectRestore:Post';
222 /* eslint-enable no-param-reassign */
223 if (!ObjectMDArchive.isValid(objectMD.archive)) {
224 log.debug('archive is not valid', {
225 archive: objectMD.archive,
226 method: '_updateRestoreInfo'
227 });
228 return errorInstances.InternalError.customizeDescription('Invalid archive metadata.');
229 }
230 return undefined;
231}
232
233/**
234 * start to restore object.

Callers 1

startRestoreFunction · 0.85

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected