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

Function listMultipartUploads

lib/api/listMultipartUploads.js:82–170  ·  view source on GitHub ↗

* list multipart uploads - Return list of open multipart uploads * @param {AuthInfo} authInfo - Instance of AuthInfo class with requester's info * @param {object} request - http request object * @param {object} log - Werelogs logger * @param {function} callback - callback to respond to http requ

(authInfo, request, log, callback)

Source from the content-addressed store, hash-verified

80 * @return {undefined}
81 */
82function listMultipartUploads(authInfo, request, log, callback) {
83 log.debug('processing request', { method: 'listMultipartUploads' });
84 const query = request.query;
85 const bucketName = request.bucketName;
86 const mpuBucketName = `${constants.mpuBucketPrefix}${bucketName}`;
87 const encoding = query['encoding-type'];
88 const prefix = query.prefix ? query.prefix : '';
89 const metadataValParams = {
90 authInfo,
91 bucketName,
92 // AWS docs state that the bucket owner and anyone with
93 // s3:ListBucketMultipartUploads rights under the bucket policies
94 // have access. They do not address ACLs at all. It seems inconsisent
95 // that someone who has read access on a bucket would not be able
96 // to list the multipart uploads so we have provided here that
97 // the authorization to list multipart uploads is the same
98 // as listing objects in a bucket.
99 requestType: request.apiMethods || 'bucketGet',
100 preciseRequestType: request.apiMethods || 'listMultipartUploads',
101 request,
102 };
103
104 async.waterfall([
105 function waterfall1(next) {
106 // Check final destination bucket for authorization rather
107 // than multipart upload bucket
108 standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log,
109 (err, bucket) => next(err, bucket));
110 },
111 function getMPUBucket(bucket, next) {
112 services.getMPUBucket(bucket, bucketName, log,
113 (err, mpuBucket) => next(err, bucket, mpuBucket));
114 },
115 function waterfall2(bucket, mpuBucket, next) {
116 let splitter = constants.splitter;
117 // BACKWARD: Remove to remove the old splitter
118 if (mpuBucket.getMdBucketModelVersion() < 2) {
119 splitter = constants.oldSplitter;
120 }
121 let maxUploads = query['max-uploads'] !== undefined ?
122 Number.parseInt(query['max-uploads'], 10) : 1000;
123 if (maxUploads < 0) {
124 monitoring.promMetrics('GET', bucketName, 400,
125 'listMultipartUploads');
126 return callback(errors.InvalidArgument, bucket);
127 }
128 if (maxUploads > constants.listingHardLimit) {
129 maxUploads = constants.listingHardLimit;
130 }
131 const listingParams = {
132 delimiter: query.delimiter,
133 keyMarker: query['key-marker'],
134 uploadIdMarker: query['upload-id-marker'],
135 maxKeys: maxUploads,
136 prefix: `overview${splitter}${prefix}`,
137 queryPrefixLength: prefix.length,
138 listingType: 'MPU',
139 splitter,

Callers 4

transientBucket.jsFile · 0.85
multipartUpload.jsFile · 0.85

Calls 5

collectCorsHeadersFunction · 0.85
pushMetricFunction · 0.85
debugMethod · 0.80
convertToXmlFunction · 0.70

Tested by

no test coverage detected