use of org.agrona.concurrent.SystemEpochClock.INSTANCE in project Aeron by real-logic.
the class ArchiveTool method migrate.
/**
* Migrate previous archive {@link org.agrona.MarkFile}, {@link Catalog}, and recordings from previous version
* to the latest version.
*
* @param out output stream to print results and errors to.
* @param archiveDir that contains MarkFile, Catalog and recordings.
*/
public static void migrate(final PrintStream out, final File archiveDir) {
final EpochClock epochClock = INSTANCE;
try {
final int markFileVersion;
final IntConsumer noVersionCheck = (version) -> {
};
try (ArchiveMarkFile markFile = openMarkFileReadWrite(archiveDir, epochClock);
Catalog catalog = openCatalogReadWrite(archiveDir, epochClock, MIN_CAPACITY, null, noVersionCheck)) {
markFileVersion = markFile.decoder().version();
out.println("MarkFile version=" + fullVersionString(markFileVersion));
out.println("Catalog version=" + fullVersionString(catalog.version()));
out.println("Latest version=" + fullVersionString(ArchiveMarkFile.SEMANTIC_VERSION));
}
final List<ArchiveMigrationStep> steps = ArchiveMigrationPlanner.createPlan(markFileVersion);
for (final ArchiveMigrationStep step : steps) {
try (ArchiveMarkFile markFile = openMarkFileReadWrite(archiveDir, epochClock);
Catalog catalog = openCatalogReadWrite(archiveDir, epochClock, MIN_CAPACITY, null, noVersionCheck)) {
out.println("Migration step " + step.toString());
step.migrate(out, markFile, catalog, archiveDir);
}
}
} catch (final Exception ex) {
ex.printStackTrace(out);
}
}
Aggregations