use of com.instaclustr.esop.impl.restore.RestorationStrategy in project esop by instaclustr.
the class BaseRestoreOperationCoordinator method coordinate.
@Override
public void coordinate(final Operation<RestoreOperationRequest> operation) throws OperationCoordinatorException {
final RestoreOperationRequest request = operation.request;
if (request.restorationStrategyType == RestorationStrategyType.IMPORT || request.restorationStrategyType == RestorationStrategyType.HARDLINKS) {
if (request.importing == null) {
throw new IllegalStateException(format("you can not run %s strategy and have 'import' empty!", request.restorationStrategyType));
}
if (request.restorationPhase == null) {
throw new IllegalStateException(format("you can not run %s strategy and have 'restorationPhase' empty!", request.restorationStrategyType));
}
}
if (request.restoreSystemKeyspace && (request.restorationStrategyType != RestorationStrategyType.IN_PLACE)) {
throw new IllegalStateException("you can not set 'restoreSystemKeyspace' to true when your restoration strategy is not IN_PLACE, " + "it is not possible to restore system keyspace on a running node");
}
try (final Restorer restorer = restorerFactoryMap.get(request.storageLocation.storageProvider).createRestorer(request)) {
final RestorationStrategy restorationStrategy = restorationStrategyResolver.resolve(request);
restorationStrategy.restore(restorer, operation);
} catch (final Exception ex) {
logger.error("Unable to perform restore! - " + ex.getMessage(), ex);
operation.addError(Error.from(ex));
}
}
Aggregations