use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashRequest in project ozone by apache.
the class OzoneManagerProtocolClientSideTranslatorPB method listTrash.
@Override
public List<RepeatedOmKeyInfo> listTrash(String volumeName, String bucketName, String startKeyName, String keyPrefix, int maxKeys) throws IOException {
Preconditions.checkArgument(Strings.isNullOrEmpty(volumeName), "The volume name cannot be null or " + "empty. Please enter a valid volume name or use '*' as a wild card");
Preconditions.checkArgument(Strings.isNullOrEmpty(bucketName), "The bucket name cannot be null or " + "empty. Please enter a valid bucket name or use '*' as a wild card");
ListTrashRequest trashRequest = ListTrashRequest.newBuilder().setVolumeName(volumeName).setBucketName(bucketName).setStartKeyName(startKeyName).setKeyPrefix(keyPrefix).setMaxKeys(maxKeys).build();
OMRequest omRequest = createOMRequest(Type.ListTrash).setListTrashRequest(trashRequest).build();
ListTrashResponse trashResponse = handleError(submitRequest(omRequest)).getListTrashResponse();
List<RepeatedOmKeyInfo> deletedKeyList = new ArrayList<>(trashResponse.getDeletedKeysCount());
List<RepeatedOmKeyInfo> list = new ArrayList<>();
for (OzoneManagerProtocolProtos.RepeatedKeyInfo repeatedKeyInfo : trashResponse.getDeletedKeysList()) {
RepeatedOmKeyInfo fromProto = RepeatedOmKeyInfo.getFromProto(repeatedKeyInfo);
list.add(fromProto);
}
deletedKeyList.addAll(list);
return deletedKeyList;
}
Aggregations