use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class TestBPTreeRecordsNonTxn method bpt_shift_3.
@Test
public void bpt_shift_3() {
BPTreeRecords bpr1 = make();
BPTreeRecords bpr2 = make();
insert(bpr1, 10, 20);
insert(bpr2, 99);
Record r = bpr1.shiftRight(bpr2, null);
assertTrue(r + " != " + RecordLib.intToRecord(10), Record.keyEQ(r, RecordLib.intToRecord(10)));
contains(bpr1, 10);
contains(bpr2, 20, 99);
bpr1.release();
bpr2.release();
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class TestBPTreeRecordsNonTxn method bpt_shift_4.
@Test
public void bpt_shift_4() {
BPTreeRecords bpr1 = make();
BPTreeRecords bpr2 = make();
insert(bpr1, 10, 20);
insert(bpr2, 5);
Record r = bpr2.shiftLeft(bpr1, null);
assertTrue(Record.keyEQ(r, RecordLib.intToRecord(10)));
contains(bpr1, 20);
contains(bpr2, 5, 10);
bpr1.release();
bpr2.release();
}
use of org.apache.jena.dboe.base.record.Record 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>> pairs = Iter.toList(iter);
System.out.println("summarizeDataBlocks: " + pairs);
for (Pair<Integer, Record> pair : pairs) {
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 pairs.iterator();
}
use of org.apache.jena.dboe.base.record.Record 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;
}
use of org.apache.jena.dboe.base.record.Record in project jena by apache.
the class TestBPlusTreeRewriterNonTxn method createData.
static List<Record> createData(int N, RecordFactory recordFactory) {
List<Record> originaldata = new ArrayList<>(N);
for (int i = 0; i < N; i++) {
Record record = recordFactory.create();
Bytes.setInt(i + 1, record.getKey());
if (recordFactory.hasValue())
Bytes.setInt(10 * i + 1, record.getValue());
originaldata.add(record);
}
return originaldata;
}
Aggregations