Compare commits
No commits in common. "a017f2592faf16b9ce4da70d9be98bda8566f356" and "4601794d49216a4bfb0fe2474fc58c301a2f0c74" have entirely different histories.
a017f2592f
...
4601794d49
|
@ -91,8 +91,7 @@ azureMpuUtils.getSubPartIds = (part, uploadId) =>
|
||||||
[...Array(part.numberSubParts).keys()].map(subPartIndex =>
|
[...Array(part.numberSubParts).keys()].map(subPartIndex =>
|
||||||
azureMpuUtils.getBlockId(uploadId, part.partNumber, subPartIndex));
|
azureMpuUtils.getBlockId(uploadId, part.partNumber, subPartIndex));
|
||||||
|
|
||||||
azureMpuUtils.putSinglePart = (that, errorWrapper, request, params,
|
azureMpuUtils.putSinglePart = (errorWrapperFn, request, params, dataStoreName,
|
||||||
dataStoreName,
|
|
||||||
log, cb) => {
|
log, cb) => {
|
||||||
const { bucketName, partNumber, size, objectKey, contentMD5, uploadId }
|
const { bucketName, partNumber, size, objectKey, contentMD5, uploadId }
|
||||||
= params;
|
= params;
|
||||||
|
@ -105,31 +104,31 @@ log, cb) => {
|
||||||
options.transactionalContentMD5 = contentMD5;
|
options.transactionalContentMD5 = contentMD5;
|
||||||
}
|
}
|
||||||
request.pipe(passThrough);
|
request.pipe(passThrough);
|
||||||
return that[errorWrapper]('uploadPart', 'createBlockFromStream',
|
return errorWrapperFn('uploadPart', 'createBlockFromStream',
|
||||||
[blockId, bucketName, objectKey, passThrough, size, options,
|
[blockId, bucketName, objectKey, passThrough, size, options,
|
||||||
(err, result) => {
|
(err, result) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('Error from Azure data backend uploadPart',
|
log.error('Error from Azure data backend uploadPart',
|
||||||
{ error: err.message, dataStoreName });
|
{ error: err.message, dataStoreName });
|
||||||
if (err.code === 'ContainerNotFound') {
|
if (err.code === 'ContainerNotFound') {
|
||||||
return cb(errors.NoSuchBucket);
|
return cb(errors.NoSuchBucket);
|
||||||
}
|
}
|
||||||
if (err.code === 'InvalidMd5') {
|
if (err.code === 'InvalidMd5') {
|
||||||
return cb(errors.InvalidDigest);
|
return cb(errors.InvalidDigest);
|
||||||
}
|
}
|
||||||
if (err.code === 'Md5Mismatch') {
|
if (err.code === 'Md5Mismatch') {
|
||||||
return cb(errors.BadDigest);
|
return cb(errors.BadDigest);
|
||||||
}
|
}
|
||||||
return cb(errors.InternalError.customizeDescription(
|
return cb(errors.InternalError.customizeDescription(
|
||||||
`Error returned from Azure: ${err.message}`)
|
`Error returned from Azure: ${err.message}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const eTag = objectUtils.getHexMD5(result.headers['content-md5']);
|
const eTag = objectUtils.getHexMD5(result.headers['content-md5']);
|
||||||
return cb(null, eTag, totalSubParts, size);
|
return cb(null, eTag, totalSubParts, size);
|
||||||
}], log, cb);
|
}], log, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
azureMpuUtils.putNextSubPart = (that, errorWrapper, partParams, subPartInfo,
|
azureMpuUtils.putNextSubPart = (errorWrapperFn, partParams, subPartInfo,
|
||||||
subPartStream, subPartIndex, resultsCollector, log, cb) => {
|
subPartStream, subPartIndex, resultsCollector, log, cb) => {
|
||||||
const { uploadId, partNumber, bucketName, objectKey } = partParams;
|
const { uploadId, partNumber, bucketName, objectKey } = partParams;
|
||||||
const subPartSize = azureMpuUtils.getSubPartSize(
|
const subPartSize = azureMpuUtils.getSubPartSize(
|
||||||
|
@ -137,12 +136,12 @@ subPartStream, subPartIndex, resultsCollector, log, cb) => {
|
||||||
const subPartId = azureMpuUtils.getBlockId(uploadId, partNumber,
|
const subPartId = azureMpuUtils.getBlockId(uploadId, partNumber,
|
||||||
subPartIndex);
|
subPartIndex);
|
||||||
resultsCollector.pushOp();
|
resultsCollector.pushOp();
|
||||||
that[errorWrapper]('uploadPart', 'createBlockFromStream',
|
errorWrapperFn('uploadPart', 'createBlockFromStream',
|
||||||
[subPartId, bucketName, objectKey, subPartStream, subPartSize,
|
[subPartId, bucketName, objectKey, subPartStream, subPartSize,
|
||||||
{}, err => resultsCollector.pushResult(err, subPartIndex)], log, cb);
|
{}, err => resultsCollector.pushResult(err, subPartIndex)], log, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
azureMpuUtils.putSubParts = (that, errorWrapper, request, params,
|
azureMpuUtils.putSubParts = (errorWrapperFn, request, params,
|
||||||
dataStoreName, log, cb) => {
|
dataStoreName, log, cb) => {
|
||||||
const subPartInfo = azureMpuUtils.getSubPartInfo(params.size);
|
const subPartInfo = azureMpuUtils.getSubPartInfo(params.size);
|
||||||
const resultsCollector = new ResultsCollector();
|
const resultsCollector = new ResultsCollector();
|
||||||
|
@ -191,7 +190,7 @@ dataStoreName, log, cb) => {
|
||||||
|
|
||||||
const currentStream = streamInterface.getCurrentStream();
|
const currentStream = streamInterface.getCurrentStream();
|
||||||
// start first put to Azure before we start streaming the data
|
// start first put to Azure before we start streaming the data
|
||||||
azureMpuUtils.putNextSubPart(that, errorWrapper, params, subPartInfo,
|
azureMpuUtils.putNextSubPart(errorWrapperFn, params, subPartInfo,
|
||||||
currentStream, 0, resultsCollector, log, cb);
|
currentStream, 0, resultsCollector, log, cb);
|
||||||
|
|
||||||
request.pipe(hashedStream);
|
request.pipe(hashedStream);
|
||||||
|
@ -212,8 +211,8 @@ dataStoreName, log, cb) => {
|
||||||
}
|
}
|
||||||
const { nextStream, subPartIndex } =
|
const { nextStream, subPartIndex } =
|
||||||
streamInterface.transitionToNextStream();
|
streamInterface.transitionToNextStream();
|
||||||
azureMpuUtils.putNextSubPart(that, errorWrapper, params,
|
azureMpuUtils.putNextSubPart(errorWrapperFn, params, subPartInfo,
|
||||||
subPartInfo, nextStream, subPartIndex, resultsCollector, log, cb);
|
nextStream, subPartIndex, resultsCollector, log, cb);
|
||||||
streamInterface.write(firstChunk);
|
streamInterface.write(firstChunk);
|
||||||
} else {
|
} else {
|
||||||
streamInterface.write(data);
|
streamInterface.write(data);
|
||||||
|
|
Loading…
Reference in New Issue