Search in sources :

Example 1 with Rename2RequestProto

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

the class ClientNamenodeProtocolTranslatorPB method rename2.

@Override
public void rename2(String src, String dst, Rename... options) throws IOException {
    boolean overwrite = false;
    boolean toTrash = false;
    if (options != null) {
        for (Rename option : options) {
            if (option == Rename.OVERWRITE) {
                overwrite = true;
            } else if (option == Rename.TO_TRASH) {
                toTrash = true;
            }
        }
    }
    Rename2RequestProto req = Rename2RequestProto.newBuilder().setSrc(src).setDst(dst).setOverwriteDest(overwrite).setMoveToTrash(toTrash).build();
    try {
        if (Client.isAsynchronousMode()) {
            rpcProxy.rename2(null, req);
            setAsyncReturnValue();
        } else {
            rpcProxy.rename2(null, req);
        }
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : Rename2RequestProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.Rename2RequestProto) ServiceException(com.google.protobuf.ServiceException) Rename(org.apache.hadoop.fs.Options.Rename)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 Rename (org.apache.hadoop.fs.Options.Rename)1 Rename2RequestProto (org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.Rename2RequestProto)1