use of org.sirix.io.berkeley.binding.PageBinding in project sirix by sirixdb.
the class BerkeleyReader method read.
@Override
public Page read(final PageReference key, final PageReadTrx pageReadTrx) throws SirixIOException {
mPageBinding = new PageBinding(mByteHandler, pageReadTrx);
final DatabaseEntry valueEntry = new DatabaseEntry();
final DatabaseEntry keyEntry = new DatabaseEntry();
TupleBinding.getPrimitiveBinding(Long.class).objectToEntry(key.getKey(), keyEntry);
Page page = null;
try {
final OperationStatus status = mDatabase.get(mTxn, keyEntry, valueEntry, LockMode.DEFAULT);
if (status == OperationStatus.SUCCESS) {
page = mPageBinding.entryToObject(valueEntry);
}
return page;
} catch (final DatabaseException exc) {
throw new SirixIOException(exc);
}
}
Aggregations