Search in sources :

Example 1 with RecordBufferPage

use of org.apache.jena.dboe.base.recordbuffer.RecordBufferPage in project jena by apache.

the class RecordBufferPageLinker method hasNext.

@Override
public boolean hasNext() {
    if (slot != null)
        return true;
    if (peekIter == null)
        return false;
    if (!peekIter.hasNext()) {
        peekIter = null;
        return false;
    }
    slot = peekIter.next();
    RecordBufferPage nextSlot = peekIter.peek();
    // If null, no slot ahead so no linkage field to set.
    if (nextSlot != null)
        // Set the slot to the id of the next one
        slot.setLink(nextSlot.getId());
    return true;
}
Also used : RecordBufferPage(org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)

Example 2 with RecordBufferPage

use of org.apache.jena.dboe.base.recordbuffer.RecordBufferPage in project jena by apache.

the class TestBPTreeRecordsNonTxn method make.

protected static BPTreeRecords make() {
    RecordBufferPage page = recordBufferPageMgr.create();
    BPTreeRecordsMgr mgr = new BPTreeRecordsMgr(null, recordFactory, recordBufferPageMgr);
    return new BPTreeRecords(mgr, page);
}
Also used : RecordBufferPage(org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)

Example 3 with RecordBufferPage

use of org.apache.jena.dboe.base.recordbuffer.RecordBufferPage in project jena by apache.

the class BPlusTreeRewriterUtils method printDataBlocks.

private static Iterator<Pair<Integer, Record>> printDataBlocks(Iterator<Pair<Integer, Record>> iter, RecordBufferPageMgr recordPageMgr) {
    divider();
    List<Pair<Integer, Record>> pairs = Iter.toList(iter);
    System.out.printf(">>Packed data blocks\n");
    for (Pair<Integer, Record> pair : pairs) {
        System.out.printf("  %s\n", pair);
        RecordBufferPage rbp = recordPageMgr.getRead(pair.car());
        // System.out.printf("RecordBufferPage[id=%d,link=%d] %d\n",
        // rbp.getId(), rbp.getLink(), rbp.getCount() );
        System.out.println(rbp);
        recordPageMgr.release(rbp);
    }
    System.out.printf("<<Packed data blocks\n");
    System.out.printf("Blocks: %d\n", pairs.size());
    return pairs.iterator();
}
Also used : Record(org.apache.jena.dboe.base.record.Record) Pair(org.apache.jena.atlas.lib.Pair) RecordBufferPage(org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)

Example 4 with RecordBufferPage

use of org.apache.jena.dboe.base.recordbuffer.RecordBufferPage in project jena by apache.

the class RecordBufferPagePacker method next.

@Override
public RecordBufferPage next() {
    if (!hasNext())
        throw new NoSuchElementException();
    RecordBufferPage rbp = recordBufferPage;
    recordBufferPage = null;
    return rbp;
}
Also used : NoSuchElementException(java.util.NoSuchElementException) RecordBufferPage(org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)

Example 5 with RecordBufferPage

use of org.apache.jena.dboe.base.recordbuffer.RecordBufferPage in project jena by apache.

the class TestRecordBufferPage method recBufferPage02.

@Test
public void recBufferPage02() {
    BlockMgr blkMgr = makeBlockMgr();
    blkMgr.beginUpdate();
    RecordBufferPageMgr rpm = new RecordBufferPageMgr(factory, blkMgr);
    int x = -99;
    {
        RecordBufferPage page1 = rpm.create();
        fill(page1.getRecordBuffer(), 10, 20, 30);
        x = page1.getId();
        rpm.put(page1);
        page1 = null;
    }
    blkMgr.endUpdate();
    blkMgr.beginRead();
    {
        RecordBufferPage page2 = rpm.getRead(x);
        assertEquals(10, get(page2, 0));
        assertEquals(20, get(page2, 1));
        assertEquals(30, get(page2, 2));
        rpm.release(page2);
    }
    blkMgr.endRead();
}
Also used : RecordBufferPageMgr(org.apache.jena.dboe.base.recordbuffer.RecordBufferPageMgr) BlockMgr(org.apache.jena.dboe.base.block.BlockMgr) RecordBufferPage(org.apache.jena.dboe.base.recordbuffer.RecordBufferPage) Test(org.junit.Test)

Aggregations

RecordBufferPage (org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)10 Pair (org.apache.jena.atlas.lib.Pair)3 Record (org.apache.jena.dboe.base.record.Record)3 RecordBufferPageMgr (org.apache.jena.dboe.base.recordbuffer.RecordBufferPageMgr)3 NoSuchElementException (java.util.NoSuchElementException)2 BlockMgr (org.apache.jena.dboe.base.block.BlockMgr)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 RecordBuffer (org.apache.jena.dboe.base.buffer.RecordBuffer)1