Search in sources :

Example 1 with GetStoragePoliciesResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetStoragePoliciesResponseProto in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method getStoragePolicies.

@Override
public GetStoragePoliciesResponseProto getStoragePolicies(RpcController controller, GetStoragePoliciesRequestProto request) throws ServiceException {
    try {
        BlockStoragePolicy[] policies = server.getStoragePolicies();
        GetStoragePoliciesResponseProto.Builder builder = GetStoragePoliciesResponseProto.newBuilder();
        if (policies == null) {
            return builder.build();
        }
        for (BlockStoragePolicy policy : policies) {
            builder.addPolicies(PBHelperClient.convert(policy));
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : GetStoragePoliciesResponseProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetStoragePoliciesResponseProto) ServiceException(com.google.protobuf.ServiceException) BlockStoragePolicy(org.apache.hadoop.hdfs.protocol.BlockStoragePolicy) IOException(java.io.IOException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 IOException (java.io.IOException)1 BlockStoragePolicy (org.apache.hadoop.hdfs.protocol.BlockStoragePolicy)1 GetStoragePoliciesResponseProto (org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.GetStoragePoliciesResponseProto)1