return statusCommand.parseOptions(operationArgs);
}
@Override
public void printResults(OperationResult operationResult) {
CleanupOperationResult concreteOperationResult = (CleanupOperationResult) operationResult;
switch (concreteOperationResult.getResultCode()) {
case NOK_DIRTY_LOCAL:
out.println("Cannot cleanup database if local repository is in a dirty state; Call 'up' first.");
break;
case NOK_RECENTLY_CLEANED:
out.println("Cleanup has been done recently, so it is not necessary. If you are sure it is necessary, override with --force.");
break;
case NOK_LOCAL_CHANGES:
out.println("Local changes detected. Please call 'up' first'.");
break;
case NOK_REMOTE_CHANGES:
out.println("Remote changes detected or repository is locked by another user. Please call 'down' first.");
break;
case NOK_OTHER_OPERATIONS_RUNNING:
out.println("Cannot run cleanup while other clients are performing up/down/cleanup. Try again later.");
break;
case OK:
if (concreteOperationResult.getMergedDatabaseFilesCount() > 0) {
out.println(concreteOperationResult.getMergedDatabaseFilesCount() + " database files merged.");
}
if (concreteOperationResult.getRemovedMultiChunks().size() > 0) {
long totalRemovedMultiChunkSize = 0;
for (MultiChunkEntry removedMultiChunk : concreteOperationResult.getRemovedMultiChunks().values()) {
totalRemovedMultiChunkSize += removedMultiChunk.getSize();
}
out.printf("%d multichunk(s) deleted on remote storage (freed %.2f MB)\n",
concreteOperationResult.getRemovedMultiChunks().size(), (double) totalRemovedMultiChunkSize / 1024 / 1024);
}
if (concreteOperationResult.getRemovedOldVersionsCount() > 0) {
out.println(concreteOperationResult.getRemovedOldVersionsCount() + " file histories shortened.");
// TODO [low] This counts only the file histories, not file versions; not very helpful!
}
out.println("Cleanup successful.");
break;
case OK_NOTHING_DONE:
out.println("Cleanup not necessary. Nothing done.");
break;
default:
throw new RuntimeException("Invalid result code: " + concreteOperationResult.getResultCode().toString());
}
}