use of com.instaclustr.esop.impl.hash.HashSpec in project esop by instaclustr.
the class HashServiceTest method testHashing.
@Test
public void testHashing() throws Exception {
final File f = File.createTempFile("hashingTest", ".tmp");
Files.write(f.toPath(), "".getBytes());
final HashService hashService = new HashServiceImpl(new HashSpec());
hashService.verify(f.toPath(), hashService.hash(f.toPath()));
}
use of com.instaclustr.esop.impl.hash.HashSpec in project esop by instaclustr.
the class Snapshots method parse.
public static synchronized Snapshots parse(final Path cassandraDir, final String snapshot) throws Exception {
if (Snapshots.hashSpec == null) {
Snapshots.hashSpec = new HashSpec();
}
final Snapshots snapshots = new Snapshots();
final SnapshotLister lister = new SnapshotLister();
Files.walkFileTree(cassandraDir, lister);
final Map<String, List<Path>> snapshotPaths = lister.getSnapshotPaths().entrySet().stream().filter(entry -> snapshot == null || (entry.getKey().equals(snapshot))).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
for (final Entry<String, List<Path>> paths : snapshotPaths.entrySet()) {
snapshots.snapshots.put(paths.getKey(), Snapshot.parse(paths.getKey(), paths.getValue()));
}
return snapshots;
}
use of com.instaclustr.esop.impl.hash.HashSpec in project esop by instaclustr.
the class RemoveBackupApplication method run.
@Override
public void run() {
Esop.logCommandVersionInformation(spec);
final List<Module> modules = Collections.singletonList(new RemoveBackupModule());
Esop.init(this, jmxSpec, new HashSpec(), request, logger, modules);
if (rate.value == 0) {
final Operation<?> operation = operationsService.submitOperationRequest(request);
await().forever().until(() -> operation.state.isTerminalState());
if (operation.state == FAILED) {
throw new IllegalStateException(format("List operation %s was not successful.", operation.id));
}
} else {
final Supplier<RemoveBackupOperation> supplier = () -> new RemoveBackupOperation(request, cassandraJMXService, restorerFactoryMap, objectMapper);
final DaemonScheduler<RemoveBackupRequest, RemoveBackupOperation> scheduler = new DaemonScheduler<>(rate, supplier);
scheduler.setup();
scheduler.execute();
}
}
Aggregations