Search in sources :

Example 11 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeNode method shiftLeft.

private void shiftLeft(BPTreePage left, BPTreePage right, int i) {
    if (logging(log)) {
        log(log, ">> shiftLeft: this:  %s", this);
        log(log, ">> shiftLeft: left:  %s", left);
        log(log, ">> shiftLeft: right: %s", right);
    }
    Record r1 = records.get(i);
    Record r2 = left.shiftLeft(right, r1);
    r2 = keyRecord(r2);
    this.records.set(i, r2);
    left.write();
    right.write();
    // Do this later - this.put();
    if (logging(log)) {
        log(log, "<< shiftLeft: this:  %s", this);
        log(log, "<< shiftLeft: left:  %s", left);
        log(log, "<< shiftLeft: right: %s", right);
    }
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 12 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeNode method getSplitKey.

@Override
final Record getSplitKey() {
    int ix = params.SplitIndex;
    Record split = records.get(ix);
    return split;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 13 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeNode method shiftLeft.

@Override
Record shiftLeft(BPTreePage other, Record splitKey) {
    BPTreeNode node = cast(other);
    if (BPT.CheckingNode) {
        if (count == 0)
            BPT.error("Node is empty - can't shift a slot out");
        if (isFull())
            BPT.error("Destination node is full");
    }
    Record r = node.records.getLow();
    // Records: promote moving element, replace with splitKey
    this.records.add(splitKey);
    node.records.shiftDown(0);
    // Pointers just shift
    this.ptrs.shiftLeft(node.ptrs);
    this.count++;
    node.count--;
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 14 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeNode method internalSearch.

// ============ SEARCH
/*
     * Do a (binary) search of the node to find the record.
     *   Returns:
     *     +ve or 0 => the index of the record
     *     -ve => The insertion point : the immediate higher record or length as (-i-1)
     *  Convert to +ve and decend to find the RecordBuffer with the record in it.
     */
@Override
final Record internalSearch(AccessPath path, Record rec) {
    if (BPT.CheckingNode)
        internalCheckNode();
    BPTreePage page = findHere(path, rec);
    Record r = page.internalSearch(path, rec);
    page.release();
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 15 with Record

use of org.apache.jena.dboe.base.record.Record in project jena by apache.

the class BPTreeRecords method internalDelete.

@Override
Record internalDelete(AccessPath path, Record record) {
    int i = rBuff.find(record);
    if (i < 0)
        return null;
    promotePage(path, this);
    Record r2 = rBuff.get(i);
    rBuff.remove(i);
    write();
    return r2;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Aggregations

Record (org.apache.jena.dboe.base.record.Record)71 RecordLib.intToRecord (org.apache.jena.dboe.test.RecordLib.intToRecord)6 Pair (org.apache.jena.atlas.lib.Pair)5 NoSuchElementException (java.util.NoSuchElementException)3 BufferChannel (org.apache.jena.dboe.base.file.BufferChannel)3 FileSet (org.apache.jena.dboe.base.file.FileSet)3 RecordBufferPage (org.apache.jena.dboe.base.recordbuffer.RecordBufferPage)3 BPTreeNode (org.apache.jena.dboe.trans.bplustree.BPTreeNode)3 BPlusTree (org.apache.jena.dboe.trans.bplustree.BPlusTree)3 BPlusTreeParams (org.apache.jena.dboe.trans.bplustree.BPlusTreeParams)3 NodeId (org.apache.jena.tdb2.store.NodeId)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 StorageException (org.apache.jena.dboe.base.StorageException)2 BlockMgr (org.apache.jena.dboe.base.block.BlockMgr)2 RecordBuffer (org.apache.jena.dboe.base.buffer.RecordBuffer)2 RecordFactory (org.apache.jena.dboe.base.record.RecordFactory)2 Index (org.apache.jena.dboe.index.Index)2 RangeIndex (org.apache.jena.dboe.index.RangeIndex)2 TDBException (org.apache.jena.tdb2.TDBException)2