BlockMgr blkMgrRecords ;
int blockSize = SystemTDB.BlockSize ;
Iterator<Record> iterator ;
RangeIndex rangeIndex = SetupTDB.makeRangeIndex(srcLoc, indexName, dftKeyLength, dftValueLength, readCacheSize, writeCacheSize) ;
BPlusTree bpt = (BPlusTree)rangeIndex ;
bptParams = bpt.getParams() ;
recordFactory = bpt.getRecordFactory() ;
int blockSizeNodes = blockSize ;
int blockSizeRecords = blockSize ;
blkMgrNodes = BlockMgrFactory.create(destination, Names.bptExtTree, blockSizeNodes, readCacheSize, writeCacheSize) ;
blkMgrRecords = BlockMgrFactory.create(destination, Names.bptExtRecords, blockSizeRecords, readCacheSize, writeCacheSize) ;
iterator = bpt.iterator() ;
// // Fakery.
// blkMgrNodes = BlockMgrFactory.create(destination, Names.bptExt1, blockSize, readCacheSize, writeCacheSize) ;
// blkMgrRecords = BlockMgrFactory.create(destination, Names.bptExt2, blockSize, readCacheSize, writeCacheSize) ;
// recordFactory = new RecordFactory(dftKeyLength, dftValueLength) ;
// bptParams = new BPlusTreeParams(3, recordFactory) ;
// List<Record> data = TestBPlusTreeRewriter.createData(10, recordFactory) ;
// iterator = data.iterator() ;
//System.out.println("Rewrite: "+srcLoc+" "+indexName+" --> "+destination) ;
BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(iterator,
bptParams, recordFactory,
blkMgrNodes, blkMgrRecords) ;
if ( bpt2 == null )
return ;
//
// Iterator<Record> iter = bpt2.iterator() ;
// for ( ; iter.hasNext() ; )
// {
// Record r = iter.next() ;
// System.out.println(r) ;
// }
bpt2.close() ;
}