+ ns.getChildNodeCount(Integer.MAX_VALUE)
+ " checkpoints");
}
if ("rm-all".equals(op)) {
long time = System.currentTimeMillis();
SegmentNodeState head = store.getHead();
NodeBuilder builder = head.builder();
NodeBuilder cps = builder.getChildNode("checkpoints");
long cnt = cps.getChildNodeCount(Integer.MAX_VALUE);
builder.setChildNode("checkpoints");
boolean ok = store.setHead(head,
(SegmentNodeState) builder.getNodeState());
time = System.currentTimeMillis() - time;
if (ok) {
System.err.println("Removed " + cnt + " checkpoints in "
+ time + "ms.");
} else {
System.err.println("Failed to remove all checkpoints.");
}
}
if ("rm".equals(op)) {
if (args.length != 3) {
System.err.println("Missing checkpoint id");
System.exit(1);
}
long time = System.currentTimeMillis();
String cp = args[2];
SegmentNodeState head = store.getHead();
NodeBuilder builder = head.builder();
NodeBuilder cpn = builder.getChildNode("checkpoints")
.getChildNode(cp);
if (cpn.exists()) {
cpn.remove();