Search in sources :

Example 1 with GetErasureCodingPoliciesResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.GetErasureCodingPoliciesResponseProto in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method getErasureCodingPolicies.

@Override
public GetErasureCodingPoliciesResponseProto getErasureCodingPolicies(RpcController controller, GetErasureCodingPoliciesRequestProto request) throws ServiceException {
    try {
        ErasureCodingPolicy[] ecPolicies = server.getErasureCodingPolicies();
        GetErasureCodingPoliciesResponseProto.Builder resBuilder = GetErasureCodingPoliciesResponseProto.newBuilder();
        for (ErasureCodingPolicy ecPolicy : ecPolicies) {
            resBuilder.addEcPolicies(PBHelperClient.convertErasureCodingPolicy(ecPolicy));
        }
        return resBuilder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : GetErasureCodingPoliciesResponseProto(org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.GetErasureCodingPoliciesResponseProto) ServiceException(com.google.protobuf.ServiceException) ErasureCodingPolicy(org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy) IOException(java.io.IOException)

Example 2 with GetErasureCodingPoliciesResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.GetErasureCodingPoliciesResponseProto in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method getErasureCodingPolicies.

@Override
public ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException {
    try {
        GetErasureCodingPoliciesResponseProto response = rpcProxy.getErasureCodingPolicies(null, VOID_GET_EC_POLICIES_REQUEST);
        ErasureCodingPolicy[] ecPolicies = new ErasureCodingPolicy[response.getEcPoliciesCount()];
        int i = 0;
        for (ErasureCodingPolicyProto ecPolicyProto : response.getEcPoliciesList()) {
            ecPolicies[i++] = PBHelperClient.convertErasureCodingPolicy(ecPolicyProto);
        }
        return ecPolicies;
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : GetErasureCodingPoliciesResponseProto(org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.GetErasureCodingPoliciesResponseProto) ServiceException(com.google.protobuf.ServiceException) ErasureCodingPolicy(org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy) ErasureCodingPolicyProto(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ErasureCodingPolicyProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 ErasureCodingPolicy (org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy)2 GetErasureCodingPoliciesResponseProto (org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.GetErasureCodingPoliciesResponseProto)2 IOException (java.io.IOException)1 ErasureCodingPolicyProto (org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ErasureCodingPolicyProto)1