use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts in project ozone by apache.
the class RpcClient method listParts.
@Override
public OzoneMultipartUploadPartListParts listParts(String volumeName, String bucketName, String keyName, String uploadID, int partNumberMarker, int maxParts) throws IOException {
verifyVolumeName(volumeName);
verifyBucketName(bucketName);
HddsClientUtils.checkNotNull(uploadID);
Preconditions.checkArgument(maxParts > 0, "Max Parts Should be greater " + "than zero");
Preconditions.checkArgument(partNumberMarker >= 0, "Part Number Marker " + "Should be greater than or equal to zero, as part numbers starts from" + " 1 and ranges till 10000");
OmMultipartUploadListParts omMultipartUploadListParts = ozoneManagerClient.listParts(volumeName, bucketName, keyName, uploadID, partNumberMarker, maxParts);
OzoneMultipartUploadPartListParts ozoneMultipartUploadPartListParts = new OzoneMultipartUploadPartListParts(omMultipartUploadListParts.getReplicationConfig(), omMultipartUploadListParts.getNextPartNumberMarker(), omMultipartUploadListParts.isTruncated());
for (OmPartInfo omPartInfo : omMultipartUploadListParts.getPartInfoList()) {
ozoneMultipartUploadPartListParts.addPart(new OzoneMultipartUploadPartListParts.PartInfo(omPartInfo.getPartNumber(), omPartInfo.getPartName(), omPartInfo.getModificationTime(), omPartInfo.getSize()));
}
return ozoneMultipartUploadPartListParts;
}
use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts in project ozone by apache.
the class TestKeyManagerUnit method listMultipartUploadPartsWithZeroUpload.
@Test
public void listMultipartUploadPartsWithZeroUpload() throws IOException {
// GIVEN
createBucket(metadataManager, "vol1", "bucket1");
OmMultipartInfo omMultipartInfo = initMultipartUpload(writeClient, "vol1", "bucket1", "dir/key1");
// WHEN
OmMultipartUploadListParts omMultipartUploadListParts = keyManager.listParts("vol1", "bucket1", "dir/key1", omMultipartInfo.getUploadID(), 0, 10);
Assert.assertEquals(0, omMultipartUploadListParts.getPartInfoList().size());
}
use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts in project ozone by apache.
the class OzoneManager method listParts.
@Override
public OmMultipartUploadListParts listParts(final String volumeName, final String bucketName, String keyName, String uploadID, int partNumberMarker, int maxParts) throws IOException {
ResolvedBucket bucket = resolveBucketLink(Pair.of(volumeName, bucketName));
Map<String, String> auditMap = bucket.audit();
auditMap.put(OzoneConsts.KEY, keyName);
auditMap.put(OzoneConsts.UPLOAD_ID, uploadID);
auditMap.put(OzoneConsts.PART_NUMBER_MARKER, Integer.toString(partNumberMarker));
auditMap.put(OzoneConsts.MAX_PARTS, Integer.toString(maxParts));
metrics.incNumListMultipartUploadParts();
try {
OmMultipartUploadListParts omMultipartUploadListParts = keyManager.listParts(bucket.realVolume(), bucket.realBucket(), keyName, uploadID, partNumberMarker, maxParts);
AUDIT.logWriteSuccess(buildAuditMessageForSuccess(OMAction.LIST_MULTIPART_UPLOAD_PARTS, auditMap));
return omMultipartUploadListParts;
} catch (IOException ex) {
metrics.incNumListMultipartUploadPartFails();
AUDIT.logWriteFailure(buildAuditMessageForFailure(OMAction.LIST_MULTIPART_UPLOAD_PARTS, auditMap, ex));
throw ex;
}
}
use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts in project ozone by apache.
the class OzoneManagerRequestHandler method listParts.
private MultipartUploadListPartsResponse listParts(MultipartUploadListPartsRequest multipartUploadListPartsRequest) throws IOException {
MultipartUploadListPartsResponse.Builder response = MultipartUploadListPartsResponse.newBuilder();
OmMultipartUploadListParts omMultipartUploadListParts = impl.listParts(multipartUploadListPartsRequest.getVolume(), multipartUploadListPartsRequest.getBucket(), multipartUploadListPartsRequest.getKey(), multipartUploadListPartsRequest.getUploadID(), multipartUploadListPartsRequest.getPartNumbermarker(), multipartUploadListPartsRequest.getMaxParts());
List<OmPartInfo> omPartInfoList = omMultipartUploadListParts.getPartInfoList();
List<PartInfo> partInfoList = new ArrayList<>();
omPartInfoList.forEach(partInfo -> partInfoList.add(partInfo.getProto()));
response.setType(omMultipartUploadListParts.getReplicationConfig().getReplicationType());
response.setFactor(ReplicationConfig.getLegacyFactor(omMultipartUploadListParts.getReplicationConfig()));
response.setNextPartNumberMarker(omMultipartUploadListParts.getNextPartNumberMarker());
response.setIsTruncated(omMultipartUploadListParts.isTruncated());
return response.addAllPartsList(partInfoList).build();
}
use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method listParts.
@Override
public OmMultipartUploadListParts listParts(String volumeName, String bucketName, String keyName, String uploadID, int partNumberMarker, int maxParts) throws IOException {
MultipartUploadListPartsRequest.Builder multipartUploadListPartsRequest = MultipartUploadListPartsRequest.newBuilder();
multipartUploadListPartsRequest.setVolume(volumeName).setBucket(bucketName).setKey(keyName).setUploadID(uploadID).setPartNumbermarker(partNumberMarker).setMaxParts(maxParts);
OMRequest omRequest = createOMRequest(Type.ListMultiPartUploadParts).setListMultipartUploadPartsRequest(multipartUploadListPartsRequest.build()).build();
MultipartUploadListPartsResponse response = handleError(submitRequest(omRequest)).getListMultipartUploadPartsResponse();
OmMultipartUploadListParts omMultipartUploadListParts = new OmMultipartUploadListParts(ReplicationConfig.fromProtoTypeAndFactor(response.getType(), response.getFactor()), response.getNextPartNumberMarker(), response.getIsTruncated());
omMultipartUploadListParts.addProtoPartList(response.getPartsListList());
return omMultipartUploadListParts;
}
Aggregations