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;
}
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);
}
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();
}
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;
}
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();
}
Aggregations