public static NamenodeCommand convert(NamenodeCommandProto cmd) { if (cmd == null) return null; switch (cmd.getType()) { case CheckPointCommand: CheckpointCommandProto chkPt = cmd.getCheckpointCmd(); return new CheckpointCommand(PBHelper.convert(chkPt.getSignature()), chkPt.getNeedToReturnImage()); default: return new NamenodeCommand(cmd.getAction()); } }
public static CheckpointCommandProto convert(CheckpointCommand cmd) { return CheckpointCommandProto.newBuilder() .setSignature(convert(cmd.getSignature())) .setNeedToReturnImage(cmd.needToReturnImage()).build(); }