Search in sources :

Example 26 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method createSnapshot.

@Override
public CreateSnapshotResponseProto createSnapshot(RpcController controller, CreateSnapshotRequestProto req) throws ServiceException {
    try {
        final CreateSnapshotResponseProto.Builder builder = CreateSnapshotResponseProto.newBuilder();
        final String snapshotPath = server.createSnapshot(req.getSnapshotRoot(), req.hasSnapshotName() ? req.getSnapshotName() : null);
        if (snapshotPath != null) {
            builder.setSnapshotPath(snapshotPath);
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : CreateSnapshotResponseProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CreateSnapshotResponseProto) ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException)

Example 27 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method getEZForPath.

@Override
public GetEZForPathResponseProto getEZForPath(RpcController controller, GetEZForPathRequestProto req) throws ServiceException {
    try {
        GetEZForPathResponseProto.Builder builder = GetEZForPathResponseProto.newBuilder();
        final EncryptionZone ret = server.getEZForPath(req.getSrc());
        if (ret != null) {
            builder.setZone(PBHelperClient.convert(ret));
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : EncryptionZone(org.apache.hadoop.hdfs.protocol.EncryptionZone) ServiceException(com.google.protobuf.ServiceException) GetEZForPathResponseProto(org.apache.hadoop.hdfs.protocol.proto.EncryptionZonesProtos.GetEZForPathResponseProto) IOException(java.io.IOException)

Example 28 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method listEncryptionZones.

@Override
public ListEncryptionZonesResponseProto listEncryptionZones(RpcController controller, ListEncryptionZonesRequestProto req) throws ServiceException {
    try {
        BatchedEntries<EncryptionZone> entries = server.listEncryptionZones(req.getId());
        ListEncryptionZonesResponseProto.Builder builder = ListEncryptionZonesResponseProto.newBuilder();
        builder.setHasMore(entries.hasMore());
        for (int i = 0; i < entries.size(); i++) {
            builder.addZones(PBHelperClient.convert(entries.get(i)));
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : EncryptionZone(org.apache.hadoop.hdfs.protocol.EncryptionZone) ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException) ListEncryptionZonesResponseProto(org.apache.hadoop.hdfs.protocol.proto.EncryptionZonesProtos.ListEncryptionZonesResponseProto)

Example 29 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method updatePipeline.

@Override
public UpdatePipelineResponseProto updatePipeline(RpcController controller, UpdatePipelineRequestProto req) throws ServiceException {
    try {
        List<DatanodeIDProto> newNodes = req.getNewNodesList();
        List<String> newStorageIDs = req.getStorageIDsList();
        server.updatePipeline(req.getClientName(), PBHelperClient.convert(req.getOldBlock()), PBHelperClient.convert(req.getNewBlock()), PBHelperClient.convert(newNodes.toArray(new DatanodeIDProto[newNodes.size()])), newStorageIDs.toArray(new String[newStorageIDs.size()]));
        return VOID_UPDATEPIPELINE_RESPONSE;
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) IOException(java.io.IOException) DatanodeIDProto(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.DatanodeIDProto)

Example 30 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolServerSideTranslatorPB method listCacheDirectives.

@Override
public ListCacheDirectivesResponseProto listCacheDirectives(RpcController controller, ListCacheDirectivesRequestProto request) throws ServiceException {
    try {
        CacheDirectiveInfo filter = PBHelperClient.convert(request.getFilter());
        BatchedEntries<CacheDirectiveEntry> entries = server.listCacheDirectives(request.getPrevId(), filter);
        ListCacheDirectivesResponseProto.Builder builder = ListCacheDirectivesResponseProto.newBuilder();
        builder.setHasMore(entries.hasMore());
        for (int i = 0, n = entries.size(); i < n; i++) {
            builder.addElements(PBHelperClient.convert(entries.get(i)));
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : CacheDirectiveInfo(org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo) ServiceException(com.google.protobuf.ServiceException) ListCacheDirectivesResponseProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ListCacheDirectivesResponseProto) CacheDirectiveEntry(org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry) IOException(java.io.IOException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)139 IOException (java.io.IOException)66 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)12 Configuration (org.apache.hadoop.conf.Configuration)11 FsPermission (org.apache.hadoop.fs.permission.FsPermission)5 Table (org.apache.hadoop.hbase.client.Table)5 CoprocessorRpcChannel (org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel)5 InetSocketAddress (java.net.InetSocketAddress)4 DatanodeCommand (org.apache.hadoop.hdfs.server.protocol.DatanodeCommand)4 ByteString (com.google.protobuf.ByteString)3 InterruptedIOException (java.io.InterruptedIOException)3 ConnectException (java.net.ConnectException)3 SocketTimeoutException (java.net.SocketTimeoutException)3 Callable (java.util.concurrent.Callable)3 ExecutionException (java.util.concurrent.ExecutionException)3 ExecutorService (java.util.concurrent.ExecutorService)3 EncryptionZone (org.apache.hadoop.hdfs.protocol.EncryptionZone)3 LocatedBlock (org.apache.hadoop.hdfs.protocol.LocatedBlock)3 Server (org.apache.hadoop.ipc.Server)3