* Gets the special multipart upload bucket associated with * the user's account or creates it if it does not exist * @param {Bucket} destinationBucket - bucket the mpu will end up in * @param {string} bucketName - name of the destination bucket * @param {object} log - Werelogs lo
(destinationBucket, bucketName, log, cb)
| 917 | * @return {undefined} |
| 918 | */ |
| 919 | getMPUBucket(destinationBucket, bucketName, log, cb) { |
| 920 | assert.strictEqual(typeof bucketName, 'string'); |
| 921 | const MPUBucketName = `${constants.mpuBucketPrefix}${bucketName}`; |
| 922 | metadata.getBucket(MPUBucketName, log, (err, bucket) => { |
| 923 | if (err?.is?.NoSuchBucket) { |
| 924 | log.trace('no buckets found'); |
| 925 | const creationDate = new Date().toJSON(); |
| 926 | const mpuBucket = new BucketInfo(MPUBucketName, |
| 927 | destinationBucket.getOwner(), |
| 928 | destinationBucket.getOwnerDisplayName(), creationDate, |
| 929 | BucketInfo.currentModelVersion()); |
| 930 | // Note that unlike during the creation of a normal bucket, |
| 931 | // we do NOT add this bucket to the lists of a user's buckets. |
| 932 | // By not adding this bucket to the lists of a user's buckets, |
| 933 | // a getService request should not return a reference to this |
| 934 | // bucket. This is the desired behavior since this should be |
| 935 | // a hidden bucket. |
| 936 | return metadata.createBucket(MPUBucketName, mpuBucket, log, |
| 937 | err => { |
| 938 | if (err) { |
| 939 | log.error('error from metadata', { error: err }); |
| 940 | return cb(err); |
| 941 | } |
| 942 | return cb(null, mpuBucket); |
| 943 | }); |
| 944 | } |
| 945 | if (err) { |
| 946 | log.error('error from metadata', { |
| 947 | error: err, |
| 948 | method: 'services.getMPUBucket', |
| 949 | }); |
| 950 | return cb(err); |
| 951 | } |
| 952 | return cb(null, bucket); |
| 953 | }); |
| 954 | }, |
| 955 | |
| 956 | getMPUparts(mpuBucketName, uploadId, log, cb) { |
| 957 | assert.strictEqual(typeof mpuBucketName, 'string'); |