/** (Testing mainly) Make an in-memory B+Tree, with copy-in, copy-out block managers */ public static BPlusTree makeMem(String name, int order, int minDataRecords, int keyLength, int valueLength) { if ( name == null ) name = "Mem" ; BPlusTreeParams params = new BPlusTreeParams(order, keyLength, valueLength) ; int blkSize ; if ( minDataRecords > 0 ) { int maxDataRecords = 2 * minDataRecords ; // int rSize = RecordBufferPage.HEADER+(maxRecords*params.getRecordLength()) ; blkSize = RecordBufferPage.calcBlockSize(params.getRecordFactory(), maxDataRecords) ; } else blkSize = params.getCalcBlockSize() ; // By FileSet BufferChannel chan = BufferChannelMem.create(name+"(root)") ; BlockMgr mgr1 = BlockMgrFactory.createMem(name + "(nodes)", params.getCalcBlockSize()) ; BlockMgr mgr2 = BlockMgrFactory.createMem(name + "(records)", blkSize) ; ComponentId cid = ComponentId.allocLocal() ; BPlusTree bpTree = BPlusTreeFactory.create(cid, params, chan, mgr1, mgr2) ; return bpTree ; }
/** (Testing mainly) Make an in-memory B+Tree, with copy-in, copy-out block managers */ public static BPlusTree makeMem(String name, int order, int minDataRecords, int keyLength, int valueLength) { if ( name == null ) name = "Mem" ; BPlusTreeParams params = new BPlusTreeParams(order, keyLength, valueLength) ; int blkSize ; if ( minDataRecords > 0 ) { int maxDataRecords = 2 * minDataRecords ; // int rSize = RecordBufferPage.HEADER+(maxRecords*params.getRecordLength()) ; blkSize = RecordBufferPage.calcBlockSize(params.getRecordFactory(), maxDataRecords) ; } else blkSize = params.getCalcBlockSize() ; // By FileSet BufferChannel chan = BufferChannelMem.create(name+"(root)") ; BlockMgr mgr1 = BlockMgrFactory.createMem(name + "(nodes)", params.getCalcBlockSize()) ; BlockMgr mgr2 = BlockMgrFactory.createMem(name + "(records)", blkSize) ; ComponentId cid = ComponentId.allocLocal() ; BPlusTree bpTree = BPlusTreeFactory.create(cid, params, chan, mgr1, mgr2) ; return bpTree ; }
BlockMgr blkMgr1 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10) ; BlockMgr blkMgr2 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10) ;
BlockMgr blkMgr1 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10) ; BlockMgr blkMgr2 = BlockMgrFactory.create(destination, Names.extBptTree, bptParams.getCalcBlockSize(), 10, 10) ;