Search in sources :

Example 16 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeRangeIterator method next.

@Override
public Record next() {
    if (!hasNext())
        throw new NoSuchElementException();
    Record r = slot;
    if (r == null)
        throw new InternalErrorException("Null slot after hasNext is true");
    slot = null;
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record) InternalErrorException(org.apache.jena.atlas.lib.InternalErrorException)

Example 17 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class RangeIndexLogger method find.

@Override
public Record find(Record record) {
    log.info("Find: " + record);
    Record r2 = super.find(record);
    log.info("Find: " + record + " ==> " + r2);
    return r2;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 18 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class RecordRangeIterator method hasNext.

@Override
public boolean hasNext() {
    if (slot != null)
        return true;
    if (currentPage == null)
        return false;
    // Set slot.
    while (currentIdx >= currentPage.getCount()) {
        // Move to next.
        int link = currentPage.getLink();
        if (link < 0) {
            close();
            return false;
        }
        if (currentPage != null)
            pageMgr.release(currentPage);
        RecordBufferPage nextPage = pageMgr.getRead(link);
        // Check currentPage -> nextPage is strictly increasing keys.
        if (false) {
            Record r1 = currentPage.getRecordBuffer().getHigh();
            Record r2 = nextPage.getRecordBuffer().getLow();
            if (Record.keyGE(r1, r2))
                throw new StorageException("RecordRangeIterator: records not strictly increasing: " + r1 + " // " + r2);
        }
        currentPage = nextPage;
        countBlocks++;
        currentIdx = 0;
    }
    slot = currentPage.getRecordBuffer().access(currentIdx, keySlot, mapper);
    currentIdx++;
    if (maxRec != null && Bytes.compare(keySlot, maxRec.getKey()) >= 0) {
        close();
        return false;
    }
    if (slot == null) {
        close();
        return false;
    }
    countRecords++;
    return true;
}
Also used : Record(org.apache.jena.dboe.base.record.Record) StorageException(org.apache.jena.dboe.base.StorageException)

Example 19 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class TestRecordBufferPage method record.

private static Record record(int i) {
    byte[] b = new byte[] { (byte) ((i >> 8) & 0xFF), (byte) (i & 0xFF) };
    Record r = factory.create(b);
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 20 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class TestRecordBufferPage method get.

private static int get(RecordBuffer rb, int idx) {
    Record r = rb.get(idx);
    int v = (r.getKey()[0]) << 8 | ((r.getKey()[1]) & 0xFF);
    return v;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Aggregations

Record (org.apache.jena.dboe.base.record.Record)71 RecordLib.intToRecord (org.apache.jena.dboe.test.RecordLib.intToRecord)6 Pair (org.apache.jena.atlas.lib.Pair)5 NoSuchElementException (java.util.NoSuchElementException)3 BufferChannel (org.apache.jena.dboe.base.file.BufferChannel)3 FileSet (org.apache.jena.dboe.base.file.FileSet)3 RecordBufferPage (org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)3 BPTreeNode (org.apache.jena.dboe.trans.bplustree.BPTreeNode)3 BPlusTree (org.apache.jena.dboe.trans.bplustree.BPlusTree)3 BPlusTreeParams (org.apache.jena.dboe.trans.bplustree.BPlusTreeParams)3 NodeId (org.apache.jena.tdb2.store.NodeId)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 StorageException (org.apache.jena.dboe.base.StorageException)2 BlockMgr (org.apache.jena.dboe.base.block.BlockMgr)2 RecordBuffer (org.apache.jena.dboe.base.buffer.RecordBuffer)2 RecordFactory (org.apache.jena.dboe.base.record.RecordFactory)2 Index (org.apache.jena.dboe.index.Index)2 RangeIndex (org.apache.jena.dboe.index.RangeIndex)2 TDBException (org.apache.jena.tdb2.TDBException)2