Search in sources :

Example 1 with MultipartInfoInitiateResponse

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());
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) DeleteKeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) OmMultipartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartInfo) MultipartInfoInitiateRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateRequest) MultipartInfoInitiateResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateResponse)

Aggregations

OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)1 OmMultipartInfo (org.apache.hadoop.ozone.om.helpers.OmMultipartInfo)1 DeleteKeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs)1 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)1 MultipartInfoInitiateRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateRequest)1 MultipartInfoInitiateResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateResponse)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1