use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.
the class TestRecordBuffer method recBuffer05.
// Shift at middle
@Test
public void recBuffer05() {
RecordBuffer rb = make(4, 5);
contains(rb, 2, 4, 6, 8);
rb.shiftUp(2);
rb.set(2, r(0));
contains(rb, 2, 4, 0, 6, 8);
rb.shiftDown(2);
contains(rb, 2, 4, 6, 8);
}
use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.
the class TestRecordBuffer method recBuffer01.
@Test
public void recBuffer01() {
RecordBuffer rb = make(4, 4);
contains(rb, 2, 4, 6, 8);
}
use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.
the class RecordBufferPageBase method reset.
protected void reset(Block block, int count) {
ByteBuffer bb = block.getByteBuffer();
bb.clear();
bb.position(headerLength);
bb = bb.slice();
this.recBuff = new RecordBuffer(bb, factory, count);
}
use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.
the class BPlusTreeTools method bpt_scan_record_buffer.
/*public*/
private static void bpt_scan_record_buffer(RecordBufferPageMgr recordPageMgr, boolean verbose) {
System.out.print("[Scan Records] start\n");
int idx = 0;
int n = 0;
int total = 0;
if (verbose)
System.out.printf("recordPageMgr = %s\n", recordPageMgr);
// Blocks in scan order
try {
while (idx >= 0) {
if (verbose)
System.out.printf("idx = %d\n", idx);
RecordBufferPage page = recordPageMgr.getRead(idx);
if (verbose)
System.out.printf("%04d :: id=%04d -> link=%04d [count=%d, max=%d]\n", n, page.getId(), page.getLink(), page.getCount(), page.getMaxSize());
RecordBuffer rb = page.getRecordBuffer();
if (verbose)
System.out.printf(" :: %d %d\n", rb.getSize(), rb.maxSize());
total += rb.size();
idx = page.getLink();
n++;
recordPageMgr.release(page);
}
} catch (Exception ex) {
System.out.println("Exception: " + ex);
}
System.out.printf("[Scan Records] Count = %d in %d blocks (avg: %.2f)\n", total, n, ((float) total) / n);
}
use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.
the class RecordBufferPagePacker method hasNext.
@Override
public boolean hasNext() {
if (recordBufferPage == null) {
if (records == null)
return false;
if (!records.hasNext()) {
records = null;
return false;
}
// At least one record to be processed.
// No pending RecordBufferPage
// ==> There will be a RecordBufferPage to yield.
// int id = rbMgr.allocateId() ;
// //System.out.println("Allocate : "+id) ;
recordBufferPage = rbMgr.create();
RecordBuffer rb = recordBufferPage.getRecordBuffer();
while (!rb.isFull() && records.hasNext()) {
Record r = records.next();
rb.add(r);
}
if (!records.hasNext())
records = null;
return true;
}
return true;
}
Aggregations