MCPcopy
hub / github.com/scality/cloudserver / _storetheMPObject

Function _storetheMPObject

lib/api/initiateMultipartUpload.js:215–305  ·  view source on GitHub ↗
(destinationBucket, corsHeaders, serverSideEncryption)

Source from the content-addressed store, hash-verified

213 }
214
215 function _storetheMPObject(destinationBucket, corsHeaders, serverSideEncryption) {
216 let cipherBundle = null;
217 if (serverSideEncryption) {
218 const { algorithm, configuredMasterKeyId, masterKeyId } = serverSideEncryption;
219 if (configuredMasterKeyId) {
220 log.debug('using user configured kms master key id');
221 }
222 cipherBundle = {
223 algorithm,
224 masterKeyId: configuredMasterKeyId || masterKeyId,
225 };
226 }
227 const backendInfoObj = locationConstraintCheck(request, null,
228 destinationBucket, log);
229 if (backendInfoObj.err) {
230 return process.nextTick(() => {
231 callback(backendInfoObj.err);
232 });
233 }
234 const locConstraint = backendInfoObj.controllingLC;
235 metadataStoreParams.controllingLocationConstraint = locConstraint;
236 metadataStoreParams.dataStoreName = locConstraint;
237
238 if (request.headers) {
239 const objectLockValError =
240 validateHeaders(destinationBucket, request.headers, log);
241 if (objectLockValError) {
242 return callback(objectLockValError);
243 }
244 }
245 const defaultRetention = destinationBucket.getObjectLockConfiguration();
246 const finalObjectLockInfo =
247 compareObjectLockInformation(request.headers, defaultRetention);
248
249 if (finalObjectLockInfo.retentionInfo) {
250 metadataStoreParams.retentionMode =
251 finalObjectLockInfo.retentionInfo.mode;
252 metadataStoreParams.retentionDate =
253 finalObjectLockInfo.retentionInfo.date;
254 }
255 if (finalObjectLockInfo.legalHold) {
256 metadataStoreParams.legalHold = finalObjectLockInfo.legalHold;
257 }
258
259 let uploadId;
260 const mpuInfo = {
261 objectKey,
262 metaHeaders,
263 bucketName,
264 locConstraint,
265 destinationBucket,
266 tagging,
267 };
268
269 const putVersionId = request.headers['x-scal-s3-version-id'];
270 const isPutVersion = putVersionId || putVersionId === '';
271 if (isPutVersion &&
272 locConstraint === destinationBucket.getLocationConstraint() &&

Callers 1

initiateMultipartUploadFunction · 0.85

Calls 6

locationConstraintCheckFunction · 0.85
validateHeadersFunction · 0.85
_getMPUBucketFunction · 0.85
debugMethod · 0.80
getLocationConstraintMethod · 0.80

Tested by

no test coverage detected