Search in sources :

Example 6 with RecordBufferPage

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

the class BPlusTreeRewriterUtils method summarizeDataBlocks.

static Iterator<Pair<Integer, Record>> summarizeDataBlocks(Iterator<Pair<Integer, Record>> iter, RecordBufferPageMgr recordPageMgr) {
    divider();
    List<Pair<Integer, Record>> x = Iter.toList(iter);
    for (Pair<Integer, Record> pair : x) {
        RecordBufferPage rbp = recordPageMgr.getRead(pair.car());
        System.out.printf("%s -- RecordBufferPage[id=%d,link=%d] (%d) -> [%s]\n", pair, rbp.getId(), rbp.getLink(), rbp.getCount(), rbp.getRecordBuffer().getHigh());
        recordPageMgr.release(rbp);
    }
    return x.iterator();
}
Also used : Record(org.apache.jena.tdb.base.record.Record) Pair(org.apache.jena.atlas.lib.Pair) RecordBufferPage(org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)

Example 7 with RecordBufferPage

use of org.apache.jena.tdb.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>> x = Iter.toList(iter);
    System.out.printf(">>Packed data blocks\n");
    for (Pair<Integer, Record> pair : x) {
        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", x.size());
    return x.iterator();
}
Also used : Record(org.apache.jena.tdb.base.record.Record) Pair(org.apache.jena.atlas.lib.Pair) RecordBufferPage(org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)

Example 8 with RecordBufferPage

use of org.apache.jena.tdb.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.tdb.base.recordbuffer.RecordBufferPage)

Example 9 with RecordBufferPage

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

the class RecordBufferPageLinker method next.

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

Example 10 with RecordBufferPage

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

the class RecordBufferPageMgr method getReadIterator.

public RecordBufferPage getReadIterator(int id) {
    Block block = blockMgr.getReadIterator(id);
    RecordBufferPage page = pageFactory.fromBlock(block);
    return page;
}
Also used : Block(org.apache.jena.tdb.base.block.Block) RecordBufferPage(org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)

Aggregations

RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)10 Pair (org.apache.jena.atlas.lib.Pair)3 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)3 Record (org.apache.jena.tdb.base.record.Record)3 RecordBufferPageMgr (org.apache.jena.tdb.base.recordbuffer.RecordBufferPageMgr)3 NoSuchElementException (java.util.NoSuchElementException)2 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 Function (java.util.function.Function)1 Iter (org.apache.jena.atlas.iterator.Iter)1 IteratorWithBuffer (org.apache.jena.atlas.iterator.IteratorWithBuffer)1 Block (org.apache.jena.tdb.base.block.Block)1 PtrBuffer (org.apache.jena.tdb.base.buffer.PtrBuffer)1 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)1 BPlusTreeRewriterUtils.divider (org.apache.jena.tdb.index.bplustree.BPlusTreeRewriterUtils.divider)1 BPlusTreeRewriterUtils.printIndexBlocks (org.apache.jena.tdb.index.bplustree.BPlusTreeRewriterUtils.printIndexBlocks)1 BPlusTreeRewriterUtils.summarizeDataBlocks (org.apache.jena.tdb.index.bplustree.BPlusTreeRewriterUtils.summarizeDataBlocks)1 Logger (org.slf4j.Logger)1