Search in sources :

Example 1 with PageBinding

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);
    }
}
Also used : PageBinding(org.sirix.io.berkeley.binding.PageBinding) OperationStatus(com.sleepycat.je.OperationStatus) UberPage(org.sirix.page.UberPage) Page(org.sirix.page.interfaces.Page) DatabaseEntry(com.sleepycat.je.DatabaseEntry) DatabaseException(com.sleepycat.je.DatabaseException) SirixIOException(org.sirix.exception.SirixIOException)

Aggregations

DatabaseEntry (com.sleepycat.je.DatabaseEntry)1 DatabaseException (com.sleepycat.je.DatabaseException)1 OperationStatus (com.sleepycat.je.OperationStatus)1 SirixIOException (org.sirix.exception.SirixIOException)1 PageBinding (org.sirix.io.berkeley.binding.PageBinding)1 UberPage (org.sirix.page.UberPage)1 Page (org.sirix.page.interfaces.Page)1