use of org.sirix.cache.IndexLogKey in project sirix by sirixdb.
the class PageReadTrxImpl method getRecord.
@Override
public Optional<Record> getRecord(final long nodeKey, final PageKind pageKind, @Nonnegative final int index) {
checkNotNull(pageKind);
assertNotClosed();
if (nodeKey == Fixed.NULL_NODE_KEY.getStandardProperty()) {
return Optional.empty();
}
final long recordPageKey = pageKey(nodeKey);
final PageContainer cont;
try {
switch(pageKind) {
case RECORDPAGE:
case PATHSUMMARYPAGE:
case PATHPAGE:
case CASPAGE:
case NAMEPAGE:
cont = mNodeCache.get(new IndexLogKey(pageKind, recordPageKey, index));
break;
default:
throw new IllegalStateException();
}
} catch (final ExecutionException | UncheckedExecutionException e) {
throw new SirixIOException(e.getCause());
}
if (PageContainer.emptyInstance().equals(cont)) {
return Optional.empty();
}
final Record retVal = ((UnorderedKeyValuePage) cont.getComplete()).getValue(nodeKey);
return checkItemIfDeleted(retVal);
}
Aggregations