use of com.torodb.core.backend.BackendConnection in project torodb by torodb.
the class DefaultConsistencyHandler method loadConsistent.
private void loadConsistent() {
try (BackendConnection conn = backendService.openConnection();
BackendTransaction trans = conn.openReadOnlyTransaction()) {
Optional<KvValue<?>> valueOpt = trans.readMetaInfo(CONSISTENCY_KEY);
if (!valueOpt.isPresent()) {
consistent = false;
return;
}
KvValue<?> value = valueOpt.get();
if (!value.getType().equals(BooleanType.INSTANCE)) {
throw new IllegalStateException("Unexpected consistency value " + "found. Expected a boolean but " + valueOpt + " was " + "found");
}
consistent = ((KvBoolean) value).getPrimitiveValue();
}
}
use of com.torodb.core.backend.BackendConnection in project torodb by torodb.
the class StampedeService method dropDatabase.
private void dropDatabase(BackendService backendService) throws UserException {
try (BackendConnection conn = backendService.openConnection();
ExclusiveWriteBackendTransaction trans = conn.openExclusiveWriteTransaction()) {
trans.dropUserData();
trans.commit();
}
}
use of com.torodb.core.backend.BackendConnection in project torodb by torodb.
the class BackendBundleImpl method postDependenciesStartUp.
@Override
protected void postDependenciesStartUp() throws Exception {
lowLevelService.startAsync();
lowLevelService.awaitRunning();
backendService.startAsync();
backendService.awaitRunning();
try (BackendConnection conn = backendService.openConnection();
ExclusiveWriteBackendTransaction trans = conn.openExclusiveWriteTransaction()) {
trans.checkOrCreateMetaDataTables();
trans.commit();
}
}
Aggregations