Search in sources :

Example 1 with GetFileStatusRequest

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

the class OzoneManagerProtocolClientSideTranslatorPB method getFileStatus.

/**
 * Get File Status for an Ozone key.
 *
 * @param args
 * @return OzoneFileStatus for the key.
 * @throws IOException
 */
@Override
public OzoneFileStatus getFileStatus(OmKeyArgs args) throws IOException {
    KeyArgs keyArgs = KeyArgs.newBuilder().setVolumeName(args.getVolumeName()).setBucketName(args.getBucketName()).setKeyName(args.getKeyName()).setSortDatanodes(args.getSortDatanodes()).setLatestVersionLocation(args.getLatestVersionLocation()).build();
    GetFileStatusRequest req = GetFileStatusRequest.newBuilder().setKeyArgs(keyArgs).build();
    OMRequest omRequest = createOMRequest(Type.GetFileStatus).setGetFileStatusRequest(req).build();
    final GetFileStatusResponse resp;
    try {
        resp = handleError(submitRequest(omRequest)).getGetFileStatusResponse();
    } catch (IOException e) {
        throw e;
    }
    return OzoneFileStatus.getFromProtobuf(resp.getStatus());
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) GetFileStatusRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusRequest) 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) GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 OmKeyArgs (org.apache.hadoop.ozone.om.helpers.OmKeyArgs)1 DeleteKeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeleteKeyArgs)1 GetFileStatusRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusRequest)1 GetFileStatusResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse)1 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1