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

Function copyPutPart

tests/multipleBackend/objectPutCopyPart.js:65–173  ·  view source on GitHub ↗
(bucketLoc, mpuLoc, srcObjLoc, requestHost, cb,
errorPutCopyPart)

Source from the content-addressed store, hash-verified

63}
64
65function copyPutPart(bucketLoc, mpuLoc, srcObjLoc, requestHost, cb,
66errorPutCopyPart) {
67 const keys = getSourceAndDestKeys();
68 const { sourceObjName, destObjName } = keys;
69 const post = bucketLoc ? '<?xml version="1.0" encoding="UTF-8"?>' +
70 '<CreateBucketConfiguration ' +
71 'xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' +
72 `<LocationConstraint>${bucketLoc}</LocationConstraint>` +
73 '</CreateBucketConfiguration>' : '';
74 const bucketPutReq = new DummyRequest({
75 bucketName,
76 namespace,
77 headers: { host: `${bucketName}.s3.amazonaws.com` },
78 url: '/',
79 post,
80 });
81 if (requestHost) {
82 bucketPutReq.parsedHost = requestHost;
83 }
84 const initiateReq = {
85 bucketName,
86 namespace,
87 objectKey: destObjName,
88 headers: { host: `${bucketName}.s3.amazonaws.com` },
89 url: `/${destObjName}?uploads`,
90 actionImplicitDenies: false,
91 };
92 if (mpuLoc) {
93 initiateReq.headers = { 'host': `${bucketName}.s3.amazonaws.com`,
94 'x-amz-meta-scal-location-constraint': `${mpuLoc}` };
95 }
96 if (requestHost) {
97 initiateReq.parsedHost = requestHost;
98 }
99 const sourceObjPutParams = {
100 bucketName,
101 namespace,
102 objectKey: sourceObjName,
103 headers: { host: `${bucketName}.s3.amazonaws.com` },
104 url: '/',
105 actionImplicitDenies: false,
106 };
107 if (srcObjLoc) {
108 sourceObjPutParams.headers = { 'host': `${bucketName}.s3.amazonaws.com`,
109 'x-amz-meta-scal-location-constraint': `${srcObjLoc}` };
110 }
111 const sourceObjPutReq = new DummyRequest(sourceObjPutParams, body);
112 if (requestHost) {
113 sourceObjPutReq.parsedHost = requestHost;
114 }
115
116 async.waterfall([
117 next => {
118 bucketPut(authInfo, bucketPutReq, log, err => {
119 assert.ifError(err, 'Error putting bucket');
120 next(err);
121 });
122 },

Callers 1

Calls 5

getSourceAndDestKeysFunction · 0.85
bucketPutFunction · 0.85
objectPutFunction · 0.85
objectPutCopyPartFunction · 0.85
initiateMultipartUploadFunction · 0.50

Tested by

no test coverage detected