public static SortedSet<CueballFilePath> getDeltas(String... dirs) throws IOException { SortedSet<CueballFilePath> result = new TreeSet<CueballFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(DELTA_REGEX, dirs); for (String path : paths) { result.add(new CueballFilePath(path)); } return result; }
public static SortedSet<CueballFilePath> getBases(String... dirs) throws IOException { SortedSet<CueballFilePath> result = new TreeSet<CueballFilePath>(); Set<String> paths = FsUtils.getMatchingPaths(BASE_REGEX, dirs); for (String path : paths) { result.add(new CueballFilePath(path)); } return result; }
public static CueballFilePath getCueballFilePathForVersion(DomainVersion version, DomainVersion currentVersion, String localPartitionRoot, String localPartitionRootCache, boolean isBase) { if (currentVersion != null && currentVersion.equals(version)) { // If version is current version, data is in root return new CueballFilePath(localPartitionRoot + "/" + Cueball.getName(version.getVersionNumber(), isBase)); } else { // Otherwise, version must be in cache return new CueballFilePath(localPartitionRootCache + "/" + Cueball.getName(version.getVersionNumber(), isBase)); } }
private static void doTestPerformanceCueballMerger(String localTmpDir, DomainVersion baseVersion, DomainVersion deltaVersion, DomainVersion newBaseVersion) throws IOException { HankTimer timer = new HankTimer(); new CueballMerger().merge( new CueballFilePath(localTmpDir + "/0/" + Cueball.getName(baseVersion)), Collections.singletonList(new CueballFilePath(localTmpDir + "/0/" + Cueball.getName(deltaVersion))), localTmpDir + "/" + Cueball.getName(newBaseVersion), KEY_HASH_SIZE, VALUE_SIZE, null, HASH_INDEX_BITS, new NoCueballCompressionCodec()); double elapsedS = timer.getDurationMs() / 1000.0; System.out.println("Merge done in " + elapsedS + " seconds"); }