use of org.apache.jena.tdb.base.block.BlockMgr in project jena by apache.
the class SetupIndex method createBPTree.
/** Knowing all the parameters, create a B+Tree */
public static BPlusTree createBPTree(FileSet fileset, int order, int blockSize, int readCacheSize, int writeCacheSize, RecordFactory factory) {
// ---- Checking
if (blockSize < 0 && order < 0)
throw new IllegalArgumentException("Neither blocksize nor order specified");
if (blockSize >= 0 && order < 0)
order = BPlusTreeParams.calcOrder(blockSize, factory.recordLength());
if (blockSize >= 0 && order >= 0) {
int order2 = BPlusTreeParams.calcOrder(blockSize, factory.recordLength());
if (order != order2)
throw new IllegalArgumentException("Wrong order (" + order + "), calculated = " + order2);
}
// Iffy - does not allow for slop.
if (blockSize < 0 && order >= 0) {
// Only in-memory.
blockSize = BPlusTreeParams.calcBlockSize(order, factory);
}
BPlusTreeParams params = new BPlusTreeParams(order, factory);
BlockMgr blkMgrNodes = BlockMgrFactory.create(fileset, Names.bptExtTree, blockSize, readCacheSize, writeCacheSize);
BlockMgr blkMgrRecords = BlockMgrFactory.create(fileset, Names.bptExtRecords, blockSize, readCacheSize, writeCacheSize);
return BPlusTree.create(params, blkMgrNodes, blkMgrRecords);
}
use of org.apache.jena.tdb.base.block.BlockMgr in project jena by apache.
the class BPlusTree method addTracking.
/** Debugging */
public static BPlusTree addTracking(BPlusTree bpTree) {
BlockMgr mgr1 = bpTree.getNodeManager().getBlockMgr();
BlockMgr mgr2 = bpTree.getRecordsMgr().getBlockMgr();
// mgr1 = BlockMgrTracker.track("BPT/Nodes", mgr1) ;
// mgr2 = BlockMgrTracker.track("BPT/Records", mgr2) ;
mgr1 = BlockMgrTracker.track(mgr1);
mgr2 = BlockMgrTracker.track(mgr2);
return BPlusTree.attach(bpTree.getParams(), mgr1, mgr2);
}
use of org.apache.jena.tdb.base.block.BlockMgr in project jena by apache.
the class TestRecordBufferPage method recBufferPage01.
@Test
public void recBufferPage01() {
BlockMgr blkMgr = makeBlockMgr();
blkMgr.beginUpdate();
RecordBufferPageMgr rpm = new RecordBufferPageMgr(factory, blkMgr);
RecordBufferPage page = rpm.create();
fill(page.getRecordBuffer(), 10, 20, 30);
assertEquals(10, get(page, 0));
assertEquals(20, get(page, 1));
assertEquals(30, get(page, 2));
rpm.release(page);
blkMgr.endUpdate();
}
use of org.apache.jena.tdb.base.block.BlockMgr in project jena by apache.
the class TestExtHash method makeIndex.
@Override
protected Index makeIndex(int kLen, int vLen) {
RecordFactory factory = new RecordFactory(kLen, vLen);
BlockMgr mgr = BlockMgrFactory.createMem("EXT", 32);
ExtHash eHash = new ExtHash(new PlainFileMem(), factory, mgr);
return eHash;
}
Aggregations