Search in sources :

Example 1 with ListStatusRequest

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

the class OzoneManagerProtocolClientSideTranslatorPB method listStatus.

@Override
public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive, String startKey, long numEntries) throws IOException {
    KeyArgs keyArgs = KeyArgs.newBuilder().setVolumeName(args.getVolumeName()).setBucketName(args.getBucketName()).setKeyName(args.getKeyName()).setSortDatanodes(args.getSortDatanodes()).setLatestVersionLocation(args.getLatestVersionLocation()).build();
    ListStatusRequest listStatusRequest = ListStatusRequest.newBuilder().setKeyArgs(keyArgs).setRecursive(recursive).setStartKey(startKey).setNumEntries(numEntries).build();
    OMRequest omRequest = createOMRequest(Type.ListStatus).setListStatusRequest(listStatusRequest).build();
    ListStatusResponse listStatusResponse = handleError(submitRequest(omRequest)).getListStatusResponse();
    List<OzoneFileStatus> statusList = new ArrayList<>(listStatusResponse.getStatusesCount());
    for (OzoneFileStatusProto fileStatus : listStatusResponse.getStatusesList()) {
        statusList.add(OzoneFileStatus.getFromProtobuf(fileStatus));
    }
    return statusList;
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OzoneFileStatusProto(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) ArrayList(java.util.ArrayList) 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) OzoneFileStatus(org.apache.hadoop.ozone.om.helpers.OzoneFileStatus) ListStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusRequest)

Aggregations

ArrayList (java.util.ArrayList)1 OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)1 OzoneFileStatus (org.apache.hadoop.ozone.om.helpers.OzoneFileStatus)1 DeleteKeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs)1 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)1 ListStatusRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusRequest)1 ListStatusResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1 OzoneFileStatusProto (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OzoneFileStatusProto)1