Search in sources :

Example 16 with BlockMgr

use of org.apache.jena.tdb.base.block.BlockMgr in project jena by apache.

the class DatasetBuilderStd method createBPTree.

/**
 * Knowing all the parameters, create a B+Tree
 */
private RangeIndex createBPTree(FileSet fileset, int order, BlockMgrBuilder blockMgrBuilderNodes, BlockMgrBuilder blockMgrBuilderRecords, RecordFactory factory, IndexParams indexParams) {
    // ---- Checking
    {
        int blockSize = indexParams.getBlockSize();
        if (blockSize < 0)
            throw new IllegalArgumentException("Negative blocksize: " + blockSize);
        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);
        }
    }
    BPlusTreeParams params = new BPlusTreeParams(order, factory);
    BlockMgr blkMgrNodes = blockMgrBuilderNodes.buildBlockMgr(fileset, Names.bptExtTree, indexParams);
    BlockMgr blkMgrRecords = blockMgrBuilderRecords.buildBlockMgr(fileset, Names.bptExtRecords, indexParams);
    return BPlusTree.create(params, blkMgrNodes, blkMgrRecords);
}
Also used : BPlusTreeParams(org.apache.jena.tdb.index.bplustree.BPlusTreeParams) BlockMgr(org.apache.jena.tdb.base.block.BlockMgr)

Aggregations

BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)16 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)6 FileSet (org.apache.jena.tdb.base.file.FileSet)5 Record (org.apache.jena.tdb.base.record.Record)5 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)5 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)4 InputStream (java.io.InputStream)2 AtlasException (org.apache.jena.atlas.AtlasException)2 Location (org.apache.jena.tdb.base.file.Location)2 PlainFileMem (org.apache.jena.tdb.base.file.PlainFileMem)2 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)2 RecordBufferPageMgr (org.apache.jena.tdb.base.recordbuffer.RecordBufferPageMgr)2 RangeIndex (org.apache.jena.tdb.index.RangeIndex)2 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)2 Test (org.junit.Test)2 BufferChannel (org.apache.jena.tdb.base.file.BufferChannel)1