use of org.apache.ignite.internal.metastorage.server.Statement in project ignite-3 by apache.
the class RocksDbKeyValueStorage method invoke.
@Override
public StatementResult invoke(If iif) {
rwLock.writeLock().lock();
try {
If currIf = iif;
byte maximumNumOfNestedBranch = 100;
while (true) {
if (maximumNumOfNestedBranch-- <= 0) {
throw new IgniteInternalException("Too many nested (" + maximumNumOfNestedBranch + ") statements in multi-invoke command.");
}
Entry[] entries = getAll(Arrays.asList(currIf.cond().keys())).toArray(new Entry[] {});
Statement branch = (currIf.cond().test(entries)) ? currIf.andThen() : currIf.orElse();
if (branch.isTerminal()) {
Update update = branch.update();
applyOperations(update.operations());
return update.result();
} else {
currIf = branch.iif();
}
}
} catch (RocksDBException e) {
throw new IgniteInternalException(e);
} finally {
rwLock.writeLock().unlock();
}
}
Aggregations