use of com.torodb.core.backend.BackendTransaction 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();
}
}
Aggregations