Search in sources :

Example 1 with OmMultipartUploadList

use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList in project ozone by apache.

the class TestKeyManagerUnit method listMultipartUploadsWithPrefix.

@Test
public void listMultipartUploadsWithPrefix() throws IOException {
    // GIVEN
    createBucket(metadataManager, "vol1", "bucket1");
    createBucket(metadataManager, "vol1", "bucket2");
    initMultipartUpload(writeClient, "vol1", "bucket1", "dip/key1");
    initMultipartUpload(writeClient, "vol1", "bucket1", "dir/key1");
    initMultipartUpload(writeClient, "vol1", "bucket1", "dir/key2");
    initMultipartUpload(writeClient, "vol1", "bucket1", "key3");
    initMultipartUpload(writeClient, "vol1", "bucket2", "dir/key1");
    // WHEN
    OmMultipartUploadList omMultipartUploadList = keyManager.listMultipartUploads("vol1", "bucket1", "dir");
    // THEN
    List<OmMultipartUpload> uploads = omMultipartUploadList.getUploads();
    Assert.assertEquals(2, uploads.size());
    Assert.assertEquals("dir/key1", uploads.get(0).getKeyName());
    Assert.assertEquals("dir/key2", uploads.get(1).getKeyName());
}
Also used : OmMultipartUpload(org.apache.hadoop.ozone.om.helpers.OmMultipartUpload) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) Test(org.junit.Test)

Example 2 with OmMultipartUploadList

use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList in project ozone by apache.

the class TestKeyManagerUnit method listMultipartUploadsWithFewEntriesInCache.

@Test
public void listMultipartUploadsWithFewEntriesInCache() throws IOException {
    String volume = UUID.randomUUID().toString();
    String bucket = UUID.randomUUID().toString();
    // GIVEN
    createBucket(metadataManager, volume, bucket);
    createBucket(metadataManager, volume, bucket);
    // Add few to cache and few to DB.
    addinitMultipartUploadToCache(volume, bucket, "dir/key1");
    initMultipartUpload(writeClient, volume, bucket, "dir/key2");
    addinitMultipartUploadToCache(volume, bucket, "dir/key3");
    initMultipartUpload(writeClient, volume, bucket, "dir/key4");
    // WHEN
    OmMultipartUploadList omMultipartUploadList = keyManager.listMultipartUploads(volume, bucket, "");
    // THEN
    List<OmMultipartUpload> uploads = omMultipartUploadList.getUploads();
    Assert.assertEquals(4, uploads.size());
    Assert.assertEquals("dir/key1", uploads.get(0).getKeyName());
    Assert.assertEquals("dir/key2", uploads.get(1).getKeyName());
    Assert.assertEquals("dir/key3", uploads.get(2).getKeyName());
    Assert.assertEquals("dir/key4", uploads.get(3).getKeyName());
    // Add few more to test prefix.
    // Same way add few to cache and few to DB.
    addinitMultipartUploadToCache(volume, bucket, "dir/ozonekey1");
    initMultipartUpload(writeClient, volume, bucket, "dir/ozonekey2");
    OmMultipartInfo omMultipartInfo3 = addinitMultipartUploadToCache(volume, bucket, "dir/ozonekey3");
    OmMultipartInfo omMultipartInfo4 = initMultipartUpload(writeClient, volume, bucket, "dir/ozonekey4");
    omMultipartUploadList = keyManager.listMultipartUploads(volume, bucket, "dir/ozone");
    // THEN
    uploads = omMultipartUploadList.getUploads();
    Assert.assertEquals(4, uploads.size());
    Assert.assertEquals("dir/ozonekey1", uploads.get(0).getKeyName());
    Assert.assertEquals("dir/ozonekey2", uploads.get(1).getKeyName());
    Assert.assertEquals("dir/ozonekey3", uploads.get(2).getKeyName());
    Assert.assertEquals("dir/ozonekey4", uploads.get(3).getKeyName());
    // Abort multipart upload for key in DB.
    abortMultipart(volume, bucket, "dir/ozonekey4", omMultipartInfo4.getUploadID());
    // Now list.
    omMultipartUploadList = keyManager.listMultipartUploads(volume, bucket, "dir/ozone");
    // THEN
    uploads = omMultipartUploadList.getUploads();
    Assert.assertEquals(3, uploads.size());
    Assert.assertEquals("dir/ozonekey1", uploads.get(0).getKeyName());
    Assert.assertEquals("dir/ozonekey2", uploads.get(1).getKeyName());
    Assert.assertEquals("dir/ozonekey3", uploads.get(2).getKeyName());
    // abort multipart upload for key in cache.
    abortMultipart(volume, bucket, "dir/ozonekey3", omMultipartInfo3.getUploadID());
    // Now list.
    omMultipartUploadList = keyManager.listMultipartUploads(volume, bucket, "dir/ozone");
    // THEN
    uploads = omMultipartUploadList.getUploads();
    Assert.assertEquals(2, uploads.size());
    Assert.assertEquals("dir/ozonekey1", uploads.get(0).getKeyName());
    Assert.assertEquals("dir/ozonekey2", uploads.get(1).getKeyName());
}
Also used : OmMultipartUpload(org.apache.hadoop.ozone.om.helpers.OmMultipartUpload) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) OmMultipartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartInfo) Test(org.junit.Test)

Example 3 with OmMultipartUploadList

use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList 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 4 with OmMultipartUploadList

use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList 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 5 with OmMultipartUploadList

use of org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList in project ozone by apache.

the class RpcClient method listMultipartUploads.

@Override
public OzoneMultipartUploadList listMultipartUploads(String volumeName, String bucketName, String prefix) throws IOException {
    OmMultipartUploadList omMultipartUploadList = ozoneManagerClient.listMultipartUploads(volumeName, bucketName, prefix);
    List<OzoneMultipartUpload> uploads = omMultipartUploadList.getUploads().stream().map(upload -> new OzoneMultipartUpload(upload.getVolumeName(), upload.getBucketName(), upload.getKeyName(), upload.getUploadId(), upload.getCreationTime(), upload.getReplicationConfig())).collect(Collectors.toList());
    OzoneMultipartUploadList result = new OzoneMultipartUploadList(uploads);
    return result;
}
Also used : ScmConfigKeys(org.apache.hadoop.hdds.scm.ScmConfigKeys) Arrays(java.util.Arrays) CryptoOutputStream(org.apache.hadoop.crypto.CryptoOutputStream) Text(org.apache.hadoop.io.Text) ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) SecureRandom(java.security.SecureRandom) OmDeleteKeys(org.apache.hadoop.ozone.om.helpers.OmDeleteKeys) OzoneManagerProtocolClientSideTranslatorPB(org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB) Map(java.util.Map) LengthInputStream(org.apache.hadoop.ozone.client.io.LengthInputStream) OmRenameKeys(org.apache.hadoop.ozone.om.helpers.OmRenameKeys) XceiverClientFactory(org.apache.hadoop.hdds.scm.XceiverClientFactory) OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) OZONE_CLIENT_KEY_PROVIDER_CACHE_EXPIRY_DEFAULT(org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_CLIENT_KEY_PROVIDER_CACHE_EXPIRY_DEFAULT) StorageUnit(org.apache.hadoop.hdds.conf.StorageUnit) ACLType(org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType) ClientId(org.apache.ratis.protocol.ClientId) OzoneOutputStream(org.apache.hadoop.ozone.client.io.OzoneOutputStream) Strings(org.apache.logging.log4j.util.Strings) InvalidKeyException(java.security.InvalidKeyException) OzoneInputStream(org.apache.hadoop.ozone.client.io.OzoneInputStream) OzoneKey(org.apache.hadoop.ozone.client.OzoneKey) OzoneCryptoInputStream(org.apache.hadoop.ozone.client.io.OzoneCryptoInputStream) OmMultipartUploadListParts(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts) GDPRSymmetricKey(org.apache.hadoop.ozone.security.GDPRSymmetricKey) Callable(java.util.concurrent.Callable) S3Auth(org.apache.hadoop.ozone.om.protocol.S3Auth) KeyInputStream(org.apache.hadoop.ozone.client.io.KeyInputStream) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) ACCESS(org.apache.hadoop.ozone.OzoneAcl.AclScope.ACCESS) BucketArgs(org.apache.hadoop.ozone.client.BucketArgs) OLD_QUOTA_DEFAULT(org.apache.hadoop.ozone.OzoneConsts.OLD_QUOTA_DEFAULT) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) OmTransportFactory(org.apache.hadoop.ozone.om.protocolPB.OmTransportFactory) CipherOutputStream(javax.crypto.CipherOutputStream) OZONE_OM_CLIENT_PROTOCOL_VERSION_KEY(org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_OM_CLIENT_PROTOCOL_VERSION_KEY) OmMultipartInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartInfo) OpenKeySession(org.apache.hadoop.ozone.om.helpers.OpenKeySession) ReplicationConfig(org.apache.hadoop.hdds.client.ReplicationConfig) DatanodeDetails(org.apache.hadoop.hdds.protocol.DatanodeDetails) IOException(java.io.IOException) BucketEncryptionKeyInfo(org.apache.hadoop.ozone.om.helpers.BucketEncryptionKeyInfo) OzoneConsts(org.apache.hadoop.ozone.OzoneConsts) Token(org.apache.hadoop.security.token.Token) FileEncryptionInfo(org.apache.hadoop.fs.FileEncryptionInfo) KeyOutputStream(org.apache.hadoop.ozone.client.io.KeyOutputStream) OmPartInfo(org.apache.hadoop.ozone.om.helpers.OmPartInfo) PipelineID(org.apache.hadoop.hdds.scm.pipeline.PipelineID) Preconditions(com.google.common.base.Preconditions) RemovalListener(com.google.common.cache.RemovalListener) ACLIdentityType(org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLIdentityType) X509Certificate(java.security.cert.X509Certificate) HddsProtos(org.apache.hadoop.hdds.protocol.proto.HddsProtos) OmMultipartUploadCompleteList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteList) OzoneManagerProtocol(org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol) LoggerFactory(org.slf4j.LoggerFactory) OzoneManagerClientProtocol(org.apache.hadoop.ozone.om.protocolPB.OzoneManagerClientProtocol) OzoneMultipartUploadList(org.apache.hadoop.ozone.client.OzoneMultipartUploadList) OmKeyArgs(org.apache.hadoop.ozone.om.helpers.OmKeyArgs) OzoneClientConfig(org.apache.hadoop.hdds.scm.OzoneClientConfig) OzoneKeyLocation(org.apache.hadoop.ozone.client.OzoneKeyLocation) ConfigurationSource(org.apache.hadoop.hdds.conf.ConfigurationSource) MultipartCryptoKeyInputStream(org.apache.hadoop.ozone.client.io.MultipartCryptoKeyInputStream) OzoneFileStatus(org.apache.hadoop.ozone.om.helpers.OzoneFileStatus) OzoneVolume(org.apache.hadoop.ozone.client.OzoneVolume) URI(java.net.URI) VolumeArgs(org.apache.hadoop.ozone.client.VolumeArgs) OzoneTokenIdentifier(org.apache.hadoop.ozone.security.OzoneTokenIdentifier) OzoneAcl(org.apache.hadoop.ozone.OzoneAcl) XceiverClientManager(org.apache.hadoop.hdds.scm.XceiverClientManager) OzoneMultipartUpload(org.apache.hadoop.ozone.client.OzoneMultipartUpload) UUID(java.util.UUID) OzoneSecurityUtil(org.apache.hadoop.ozone.OzoneSecurityUtil) Collectors(java.util.stream.Collectors) ReplicationType(org.apache.hadoop.hdds.client.ReplicationType) ComparableVersion(org.apache.hadoop.util.ComparableVersion) List(java.util.List) IOUtils(org.apache.hadoop.hdds.utils.IOUtils) OMException(org.apache.hadoop.ozone.om.exceptions.OMException) OmMultipartUploadCompleteInfo(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo) OzoneObj(org.apache.hadoop.ozone.security.acl.OzoneObj) OzoneConfigKeys(org.apache.hadoop.ozone.OzoneConfigKeys) ServiceInfoEx(org.apache.hadoop.ozone.om.helpers.ServiceInfoEx) CacheBuilder(com.google.common.cache.CacheBuilder) NotNull(org.jetbrains.annotations.NotNull) StorageType(org.apache.hadoop.hdds.protocol.StorageType) OmTransport(org.apache.hadoop.ozone.om.protocolPB.OmTransport) ClientProtocol(org.apache.hadoop.ozone.client.protocol.ClientProtocol) HashMap(java.util.HashMap) Cipher(javax.crypto.Cipher) Function(java.util.function.Function) CipherInputStream(javax.crypto.CipherInputStream) OzoneBucket(org.apache.hadoop.ozone.client.OzoneBucket) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) OmKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyInfo) OmKeyLocationInfo(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo) OzoneKeyDetails(org.apache.hadoop.ozone.client.OzoneKeyDetails) S3SecretValue(org.apache.hadoop.ozone.om.helpers.S3SecretValue) Nonnull(javax.annotation.Nonnull) OMConfigKeys(org.apache.hadoop.ozone.om.OMConfigKeys) OzoneAclUtil(org.apache.hadoop.ozone.om.helpers.OzoneAclUtil) OmBucketArgs(org.apache.hadoop.ozone.om.helpers.OmBucketArgs) RemovalNotification(com.google.common.cache.RemovalNotification) Logger(org.slf4j.Logger) OzoneAclConfig(org.apache.hadoop.ozone.security.acl.OzoneAclConfig) Pipeline(org.apache.hadoop.hdds.scm.pipeline.Pipeline) OZONE_CLIENT_KEY_PROVIDER_CACHE_EXPIRY(org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_CLIENT_KEY_PROVIDER_CACHE_EXPIRY) ReplicationFactor(org.apache.hadoop.hdds.client.ReplicationFactor) OmVolumeArgs(org.apache.hadoop.ozone.om.helpers.OmVolumeArgs) TimeUnit(java.util.concurrent.TimeUnit) KeyProvider(org.apache.hadoop.crypto.key.KeyProvider) RepeatedOmKeyInfo(org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo) TracingUtil(org.apache.hadoop.hdds.tracing.TracingUtil) OmKeyLocationInfoGroup(org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfoGroup) HddsClientUtils(org.apache.hadoop.hdds.scm.client.HddsClientUtils) OMRoleInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRoleInfo) OzoneMultipartUploadPartListParts(org.apache.hadoop.ozone.client.OzoneMultipartUploadPartListParts) VisibleForTesting(com.google.common.annotations.VisibleForTesting) CryptoInputStream(org.apache.hadoop.crypto.CryptoInputStream) Cache(com.google.common.cache.Cache) Collections(java.util.Collections) OzoneMultipartUploadList(org.apache.hadoop.ozone.client.OzoneMultipartUploadList) OmMultipartUploadList(org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList) OzoneMultipartUpload(org.apache.hadoop.ozone.client.OzoneMultipartUpload)

Aggregations

OmMultipartUploadList (org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList)8 IOException (java.io.IOException)5 OmMultipartUpload (org.apache.hadoop.ozone.om.helpers.OmMultipartUpload)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 ReplicationConfig (org.apache.hadoop.hdds.client.ReplicationConfig)4 OzoneAcl (org.apache.hadoop.ozone.OzoneAcl)4 OMException (org.apache.hadoop.ozone.om.exceptions.OMException)4 OmBucketInfo (org.apache.hadoop.ozone.om.helpers.OmBucketInfo)4 OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)4 OmKeyInfo (org.apache.hadoop.ozone.om.helpers.OmKeyInfo)4 OmMultipartUploadListParts (org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts)4 OzoneFileStatus (org.apache.hadoop.ozone.om.helpers.OzoneFileStatus)4 RepeatedOmKeyInfo (org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Preconditions (com.google.common.base.Preconditions)2 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)2 Instant (java.time.Instant)2 Arrays (java.util.Arrays)2