Search in sources :

Example 1 with AppendRequestProto

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

the class ClientNamenodeProtocolTranslatorPB method append.

@Override
public LastBlockWithStatus append(String src, String clientName, EnumSetWritable<CreateFlag> flag) throws IOException {
    AppendRequestProto req = AppendRequestProto.newBuilder().setSrc(src).setClientName(clientName).setFlag(PBHelperClient.convertCreateFlag(flag)).build();
    try {
        AppendResponseProto res = rpcProxy.append(null, req);
        LocatedBlock lastBlock = res.hasBlock() ? PBHelperClient.convertLocatedBlockProto(res.getBlock()) : null;
        HdfsFileStatus stat = (res.hasStat()) ? PBHelperClient.convert(res.getStat()) : null;
        return new LastBlockWithStatus(lastBlock, stat);
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) LastBlockWithStatus(org.apache.hadoop.hdfs.protocol.LastBlockWithStatus) AppendResponseProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AppendResponseProto) HdfsFileStatus(org.apache.hadoop.hdfs.protocol.HdfsFileStatus) LocatedBlock(org.apache.hadoop.hdfs.protocol.LocatedBlock) AppendRequestProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AppendRequestProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 HdfsFileStatus (org.apache.hadoop.hdfs.protocol.HdfsFileStatus)1 LastBlockWithStatus (org.apache.hadoop.hdfs.protocol.LastBlockWithStatus)1 LocatedBlock (org.apache.hadoop.hdfs.protocol.LocatedBlock)1 AppendRequestProto (org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AppendRequestProto)1 AppendResponseProto (org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AppendResponseProto)1