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

Function handleTaggingOperation

lib/routes/routeBackbeat.js:286–314  ·  view source on GitHub ↗
(request, response, type, dataStoreVersionId, log, callback)

Source from the content-addressed store, hash-verified

284}
285
286function handleTaggingOperation(request, response, type, dataStoreVersionId, log, callback) {
287 const storageLocation = request.headers['x-scal-storage-class'];
288 const objectMD = {
289 dataStoreName: storageLocation,
290 location: [{ dataStoreVersionId }],
291 };
292 if (type === 'Put') {
293 try {
294 const tags = JSON.parse(request.headers['x-scal-tags']);
295 objectMD.tags = tags;
296 } catch {
297 // FIXME: add error type MalformedJSON
298 return callback(errors.MalformedPOSTRequest);
299 }
300 }
301 return dataClient.objectTagging(type, request.objectKey, request.bucketName, objectMD, log, err => {
302 if (err) {
303 log.error(`error during object tagging: ${type}`, {
304 error: err,
305 method: 'handleTaggingOperation',
306 });
307 return callback(err);
308 }
309 const dataRetrievalInfo = {
310 versionId: dataStoreVersionId,
311 };
312 return response ? _respond(response, dataRetrievalInfo, log, callback) : callback();
313 });
314}
315
316/*
317PUT /_/backbeat/metadata/<bucket name>/<object key>

Callers 3

putObjectTaggingFunction · 0.85
deleteObjectTaggingFunction · 0.85
_putTaggingFunction · 0.85

Calls 2

_respondFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected