Search in sources :

Example 1 with ListMultipartUploadsResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse in project ozone by apache.

the class OzoneManagerProtocolClientSideTranslatorPB method listMultipartUploads.

@Override
public OmMultipartUploadList listMultipartUploads(String volumeName, String bucketName, String prefix) throws IOException {
    ListMultipartUploadsRequest request = ListMultipartUploadsRequest.newBuilder().setVolume(volumeName).setBucket(bucketName).setPrefix(prefix == null ? "" : prefix).build();
    OMRequest omRequest = createOMRequest(Type.ListMultipartUploads).setListMultipartUploadsRequest(request).build();
    ListMultipartUploadsResponse listMultipartUploadsResponse = handleError(submitRequest(omRequest)).getListMultipartUploadsResponse();
    List<OmMultipartUpload> uploadList = listMultipartUploadsResponse.getUploadsListList().stream().map(proto -> new OmMultipartUpload(proto.getVolumeName(), proto.getBucketName(), proto.getKeyName(), proto.getUploadId(), Instant.ofEpochMilli(proto.getCreationTime()), ReplicationConfig.fromProtoTypeAndFactor(proto.getType(), proto.getFactor()))).collect(Collectors.toList());
    OmMultipartUploadList response = new OmMultipartUploadList(uploadList);
    return response;
}
Also used : ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) GetDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetDelegationTokenResponseProto) OmMultipartCommitUploadPartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartCommitUploadPartInfo) Text(org.apache.hadoop.io.Text) ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) DeleteKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyRequest) OmDeleteKeys(org.apache.hadoop.ozone.om.helpers.OmDeleteKeys) FinalizeUpgradeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeRequest) AllocateBlockRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AllocateBlockRequest) LookupFileRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileRequest) ListKeysResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse) GetFileStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusRequest) Map(java.util.Map) DBUpdates(org.apache.hadoop.ozone.om.helpers.DBUpdates) GetS3SecretResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3SecretResponse) MultipartUploadListPartsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsRequest) OmRenameKeys(org.apache.hadoop.ozone.om.helpers.OmRenameKeys) CancelDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.CancelDelegationTokenRequestProto) SetBucketPropertyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetBucketPropertyRequest) AddAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest) CommitKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CommitKeyRequest) MultipartCommitUploadPartResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartCommitUploadPartResponse) OK(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.OK) OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) MultipartUploadCompleteResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteResponse) CreateFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateFileResponse) OzoneFileStatusProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto) RevokeS3SecretRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RevokeS3SecretRequest) CheckVolumeAccessRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessRequest) KeyValueUtil(org.apache.hadoop.ozone.om.helpers.KeyValueUtil) SetBucketPropertyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetBucketPropertyResponse) BucketInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.BucketInfo) CancelPrepareResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelPrepareResponse) AllocateBlockResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AllocateBlockResponse) OMPBHelper(org.apache.hadoop.ozone.protocolPB.OMPBHelper) CreateBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateBucketRequest) PrepareResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareResponse) GetS3SecretRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3SecretRequest) ExcludeList(org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList) AddAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclResponse) RenameKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysRequest) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) GetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse) OzoneAclInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneAclInfo) MultipartInfoInitiateResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateResponse) ListBucketsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse) CreateVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateVolumeRequest) DeleteVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteVolumeRequest) RecoverTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashResponse) OmMultipartUploadListParts(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts) SetVolumePropertyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetVolumePropertyResponse) CancelPrepareRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelPrepareRequest) S3Auth(org.apache.hadoop.ozone.om.protocol.S3Auth) GetAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclRequest) SetVolumePropertyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetVolumePropertyRequest) InfoVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeRequest) ArrayList(java.util.ArrayList) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) Strings(com.google.common.base.Strings) RenewDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenewDelegationTokenResponseProto) SetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetAclResponse) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) DeleteBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteBucketRequest) PrepareRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareRequest) GetDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.GetDelegationTokenRequestProto) OmMultipartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartInfo) OpenKeySession(org.apache.hadoop.ozone.om.helpers.OpenKeySession) ReplicationConfig(org.apache.hadoop.hdds.client.ReplicationConfig) IOException(java.io.IOException) PrepareRequestArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareRequestArgs) Token(org.apache.hadoop.security.token.Token) ListBucketsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsRequest) InterfaceAudience(org.apache.hadoop.hdds.annotation.InterfaceAudience) CreateFileRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateFileRequest) MultipartUploadAbortRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadAbortRequest) RenewDelegationTokenRequestProto(org.apache.hadoop.ozone.security.proto.SecurityProtos.RenewDelegationTokenRequestProto) RenameKeysArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysArgs) Preconditions(com.google.common.base.Preconditions) OmMultipartUploadCompleteList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteList) GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) VolumeInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.VolumeInfo) UpgradeFinalizer(org.apache.hadoop.ozone.upgrade.UpgradeFinalizer) MultipartCommitUploadPartRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartCommitUploadPartRequest) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) ListStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusRequest) CreateDirectoryRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateDirectoryRequest) OzoneFileStatus(org.apache.hadoop.ozone.om.helpers.OzoneFileStatus) ListTrashRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashRequest) StatusAndMessages(org.apache.hadoop.ozone.upgrade.UpgradeFinalizer.StatusAndMessages) OzoneTokenIdentifier(org.apache.hadoop.ozone.security.OzoneTokenIdentifier) OzoneAcl(org.apache.hadoop.ozone.OzoneAcl) OmMultipartUpload(org.apache.hadoop.ozone.om.helpers.OmMultipartUpload) LookupKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyResponse) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) ListTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) DBUpdatesResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse) FinalizeUpgradeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeResponse) ByteString(com.google.protobuf.ByteString) List(java.util.List) ServiceListRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest) OMException(org.apache.hadoop.ozone.om.exceptions.OMException) OmMultipartUploadCompleteInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo) OzoneObj(org.apache.hadoop.ozone.security.acl.OzoneObj) ListVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeRequest) LookupFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileResponse) MultipartUploadCompleteRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadCompleteRequest) DIRECTORY_ALREADY_EXISTS(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.DIRECTORY_ALREADY_EXISTS) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) DeleteKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeysRequest) CreateKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateKeyResponse) PrepareStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusRequest) CURRENT_VERSION(org.apache.hadoop.ozone.ClientVersions.CURRENT_VERSION) DeleteKeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse) RenameKeysMap(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeysMap) LookupKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyRequest) UpgradeFinalizationStatus(org.apache.hadoop.hdds.protocol.proto.HddsProtos.UpgradeFinalizationStatus) ResultCodes(org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes) ACCESS_DENIED(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.ACCESS_DENIED) SetAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SetAclRequest) DBUpdatesRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesRequest) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) InfoBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketRequest) TOKEN_ERROR_OTHER(org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.TOKEN_ERROR_OTHER) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) OmKeyLocationInfo(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo) S3SecretValue(org.apache.hadoop.ozone.om.helpers.S3SecretValue) MultipartInfoInitiateRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartInfoInitiateRequest) FinalizeUpgradeProgressRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressRequest) OmBucketArgs(org.apache.hadoop.ozone.om.helpers.OmBucketArgs) CancelDelegationTokenResponseProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CancelDelegationTokenResponseProto) S3Authentication(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication) InfoVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse) RecoverTrashRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RecoverTrashRequest) BucketArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.BucketArgs) CreateKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateKeyRequest) InfoBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse) ListKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysRequest) OmVolumeArgs(org.apache.hadoop.ozone.om.helpers.OmVolumeArgs) RenameKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RenameKeyRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) MultipartUploadListPartsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsResponse) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) FinalizeUpgradeProgressResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse) TracingUtil(org.apache.hadoop.hdds.tracing.TracingUtil) RemoveAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RemoveAclResponse) ListVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse) PrepareStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ListMultipartUploadsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsRequest) RemoveAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RemoveAclRequest) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OmMultipartUpload(org.apache.hadoop.ozone.om.helpers.OmMultipartUpload) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) ListMultipartUploadsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsRequest)

Example 2 with ListMultipartUploadsResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse in project ozone by apache.

the class OzoneManagerRequestHandler method listMultipartUploads.

private ListMultipartUploadsResponse listMultipartUploads(ListMultipartUploadsRequest request) throws IOException {
    OmMultipartUploadList omMultipartUploadList = impl.listMultipartUploads(request.getVolume(), request.getBucket(), request.getPrefix());
    List<MultipartUploadInfo> info = omMultipartUploadList.getUploads().stream().map(upload -> MultipartUploadInfo.newBuilder().setVolumeName(upload.getVolumeName()).setBucketName(upload.getBucketName()).setKeyName(upload.getKeyName()).setUploadId(upload.getUploadId()).setType(upload.getReplicationConfig().getReplicationType()).setFactor(ReplicationConfig.getLegacyFactor(upload.getReplicationConfig())).setCreationTime(upload.getCreationTime().toEpochMilli()).build()).collect(Collectors.toList());
    ListMultipartUploadsResponse response = ListMultipartUploadsResponse.newBuilder().addAllUploadsList(info).build();
    return response;
}
Also used : GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) LoggerFactory(org.slf4j.LoggerFactory) ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) Status(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status) ListStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusRequest) LookupFileRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileRequest) OzoneFileStatus(org.apache.hadoop.ozone.om.helpers.OzoneFileStatus) ListTrashRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashRequest) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) ListKeysResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse) OzoneManagerRatisUtils(org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerRatisUtils) GetFileStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusRequest) DBUpdates(org.apache.hadoop.ozone.om.helpers.DBUpdates) OzoneManagerProtocolProtos(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos) StatusAndMessages(org.apache.hadoop.ozone.upgrade.UpgradeFinalizer.StatusAndMessages) MultipartUploadListPartsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsRequest) OzoneAcl(org.apache.hadoop.ozone.OzoneAcl) OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) CheckVolumeAccessResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessResponse) CheckVolumeAccessRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessRequest) LookupKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyResponse) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) ListTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse) OmResponseUtil(org.apache.hadoop.ozone.om.request.util.OmResponseUtil) Collectors(java.util.stream.Collectors) DBUpdatesResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse) List(java.util.List) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) ServiceListRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListRequest) OzoneObjInfo(org.apache.hadoop.ozone.security.acl.OzoneObjInfo) OMException(org.apache.hadoop.ozone.om.exceptions.OMException) GetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse) OzoneManagerPrepareState(org.apache.hadoop.ozone.om.OzoneManagerPrepareState) OMClientRequest(org.apache.hadoop.ozone.om.request.OMClientRequest) OzoneAclInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneAclInfo) ListVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeRequest) LookupFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileResponse) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) ListBucketsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse) SequenceNumberNotFoundException(org.apache.hadoop.hdds.utils.db.SequenceNumberNotFoundException) OmMultipartUploadListParts(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse) GetAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclRequest) InfoVolumeRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeRequest) LookupKeyRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyRequest) UpgradeFinalizationStatus(org.apache.hadoop.hdds.protocol.proto.HddsProtos.UpgradeFinalizationStatus) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) ArrayList(java.util.ArrayList) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) Lists(com.google.common.collect.Lists) DBUpdatesRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesRequest) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) InfoBucketRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketRequest) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) FinalizeUpgradeProgressRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressRequest) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) InfoVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse) Logger(org.slf4j.Logger) PartInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PartInfo) MultipartUploadInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadInfo) ReplicationConfig(org.apache.hadoop.hdds.client.ReplicationConfig) IOException(java.io.IOException) InfoBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse) ListKeysRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysRequest) OmVolumeArgs(org.apache.hadoop.ozone.om.helpers.OmVolumeArgs) ListBucketsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsRequest) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) MultipartUploadListPartsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsResponse) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) FinalizeUpgradeProgressResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse) OmPartInfo(org.apache.hadoop.ozone.om.helpers.OmPartInfo) OzoneManagerDoubleBuffer(org.apache.hadoop.ozone.om.ratis.OzoneManagerDoubleBuffer) ListVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse) PrepareStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse) ListMultipartUploadsRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsRequest) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) MultipartUploadInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadInfo)

Example 3 with ListMultipartUploadsResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse in project ozone by apache.

the class OzoneManagerRequestHandler method handleReadRequest.

// TODO simplify it to make it shorter
@SuppressWarnings("methodlength")
@Override
public OMResponse handleReadRequest(OMRequest request) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Received OMRequest: {}, ", request);
    }
    Type cmdType = request.getCmdType();
    OMResponse.Builder responseBuilder = OmResponseUtil.getOMResponseBuilder(request);
    try {
        switch(cmdType) {
            case CheckVolumeAccess:
                CheckVolumeAccessResponse checkVolumeAccessResponse = checkVolumeAccess(request.getCheckVolumeAccessRequest());
                responseBuilder.setCheckVolumeAccessResponse(checkVolumeAccessResponse);
                break;
            case InfoVolume:
                InfoVolumeResponse infoVolumeResponse = infoVolume(request.getInfoVolumeRequest());
                responseBuilder.setInfoVolumeResponse(infoVolumeResponse);
                break;
            case ListVolume:
                ListVolumeResponse listVolumeResponse = listVolumes(request.getListVolumeRequest());
                responseBuilder.setListVolumeResponse(listVolumeResponse);
                break;
            case InfoBucket:
                InfoBucketResponse infoBucketResponse = infoBucket(request.getInfoBucketRequest());
                responseBuilder.setInfoBucketResponse(infoBucketResponse);
                break;
            case ListBuckets:
                ListBucketsResponse listBucketsResponse = listBuckets(request.getListBucketsRequest());
                responseBuilder.setListBucketsResponse(listBucketsResponse);
                break;
            case LookupKey:
                LookupKeyResponse lookupKeyResponse = lookupKey(request.getLookupKeyRequest(), request.getVersion());
                responseBuilder.setLookupKeyResponse(lookupKeyResponse);
                break;
            case ListKeys:
                ListKeysResponse listKeysResponse = listKeys(request.getListKeysRequest(), request.getVersion());
                responseBuilder.setListKeysResponse(listKeysResponse);
                break;
            case ListTrash:
                ListTrashResponse listTrashResponse = listTrash(request.getListTrashRequest(), request.getVersion());
                responseBuilder.setListTrashResponse(listTrashResponse);
                break;
            case ListMultiPartUploadParts:
                MultipartUploadListPartsResponse listPartsResponse = listParts(request.getListMultipartUploadPartsRequest());
                responseBuilder.setListMultipartUploadPartsResponse(listPartsResponse);
                break;
            case ListMultipartUploads:
                ListMultipartUploadsResponse response = listMultipartUploads(request.getListMultipartUploadsRequest());
                responseBuilder.setListMultipartUploadsResponse(response);
                break;
            case ServiceList:
                ServiceListResponse serviceListResponse = getServiceList(request.getServiceListRequest());
                responseBuilder.setServiceListResponse(serviceListResponse);
                break;
            case DBUpdates:
                DBUpdatesResponse dbUpdatesResponse = getOMDBUpdates(request.getDbUpdatesRequest());
                responseBuilder.setDbUpdatesResponse(dbUpdatesResponse);
                break;
            case GetFileStatus:
                GetFileStatusResponse getFileStatusResponse = getOzoneFileStatus(request.getGetFileStatusRequest(), request.getVersion());
                responseBuilder.setGetFileStatusResponse(getFileStatusResponse);
                break;
            case LookupFile:
                LookupFileResponse lookupFileResponse = lookupFile(request.getLookupFileRequest(), request.getVersion());
                responseBuilder.setLookupFileResponse(lookupFileResponse);
                break;
            case ListStatus:
                ListStatusResponse listStatusResponse = listStatus(request.getListStatusRequest(), request.getVersion());
                responseBuilder.setListStatusResponse(listStatusResponse);
                break;
            case GetAcl:
                GetAclResponse getAclResponse = getAcl(request.getGetAclRequest());
                responseBuilder.setGetAclResponse(getAclResponse);
                break;
            case FinalizeUpgradeProgress:
                FinalizeUpgradeProgressResponse upgradeProgressResponse = reportUpgradeProgress(request.getFinalizeUpgradeProgressRequest());
                responseBuilder.setFinalizeUpgradeProgressResponse(upgradeProgressResponse);
                break;
            case PrepareStatus:
                PrepareStatusResponse prepareStatusResponse = getPrepareStatus();
                responseBuilder.setPrepareStatusResponse(prepareStatusResponse);
                break;
            default:
                responseBuilder.setSuccess(false);
                responseBuilder.setMessage("Unrecognized Command Type: " + cmdType);
                break;
        }
        responseBuilder.setSuccess(true);
    } catch (IOException ex) {
        responseBuilder.setSuccess(false);
        responseBuilder.setStatus(exceptionToResponseStatus(ex));
        if (ex.getMessage() != null) {
            responseBuilder.setMessage(ex.getMessage());
        }
    }
    return responseBuilder.build();
}
Also used : FinalizeUpgradeProgressResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse) InfoBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse) LookupKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyResponse) DBUpdatesResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse) CheckVolumeAccessResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessResponse) ListKeysResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse) IOException(java.io.IOException) GetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) ListBucketsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) ListVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse) ListTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) MultipartUploadListPartsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsResponse) GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) InfoVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse) PrepareStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse) LookupFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileResponse)

Aggregations

IOException (java.io.IOException)3 DBUpdatesResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse)3 FinalizeUpgradeProgressResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse)3 GetAclResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse)3 GetFileStatusResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse)3 InfoBucketResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse)3 InfoVolumeResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse)3 ListBucketsResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse)3 ListKeysResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse)3 ListMultipartUploadsResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 ReplicationConfig (org.apache.hadoop.hdds.client.ReplicationConfig)2 UpgradeFinalizationStatus (org.apache.hadoop.hdds.protocol.proto.HddsProtos.UpgradeFinalizationStatus)2 OzoneAcl (org.apache.hadoop.ozone.OzoneAcl)2 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)2 DBUpdates (org.apache.hadoop.ozone.om.helpers.DBUpdates)2 OmBucketInfo (org.apache.hadoop.ozone.om.helpers.OmBucketInfo)2 OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)2