use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateResponse in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method initiateMultipartUpload.
/**
* Return the proxy object underlying this protocol translator.
*
* @return the proxy object underlying this protocol translator.
*/
@Override
public OmMultipartInfo initiateMultipartUpload(OmKeyArgs omKeyArgs) throws IOException {
MultipartInfoInitiateRequest.Builder multipartInfoInitiateRequest = MultipartInfoInitiateRequest.newBuilder();
KeyArgs.Builder keyArgs = KeyArgs.newBuilder().setVolumeName(omKeyArgs.getVolumeName()).setBucketName(omKeyArgs.getBucketName()).setKeyName(omKeyArgs.getKeyName()).addAllAcls(omKeyArgs.getAcls().stream().map(a -> OzoneAcl.toProtobuf(a)).collect(Collectors.toList()));
if (omKeyArgs.getReplicationConfig() != null) {
keyArgs.setFactor(ReplicationConfig.getLegacyFactor(omKeyArgs.getReplicationConfig()));
keyArgs.setType(omKeyArgs.getReplicationConfig().getReplicationType());
}
multipartInfoInitiateRequest.setKeyArgs(keyArgs.build());
OMRequest omRequest = createOMRequest(Type.InitiateMultiPartUpload).setInitiateMultiPartUploadRequest(multipartInfoInitiateRequest.build()).build();
MultipartInfoInitiateResponse resp = handleError(submitRequest(omRequest)).getInitiateMultiPartUploadResponse();
return new OmMultipartInfo(resp.getVolumeName(), resp.getBucketName(), resp.getKeyName(), resp.getMultipartUploadID());
}
Aggregations