Search in sources :

Example 51 with Record

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

the class BPTreeRecords method checkNode.

@Override
public final void checkNode() {
    if (!CheckingNode)
        return;
    if (rBuff.size() < 0 || rBuff.size() > rBuff.maxSize())
        error("Misized: %s", this);
    for (int i = 1; i < getCount(); i++) {
        Record r1 = rBuff.get(i - 1);
        Record r2 = rBuff.get(i);
        if (Record.keyGT(r1, r2))
            error("Not sorted: %s", this);
    }
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 52 with Record

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

the class BPTreeRecords method internalInsert.

@Override
Record internalInsert(AccessPath path, Record record) {
    // Delay promotion until we know change will happen.
    int i = rBuff.find(record);
    Record r2 = null;
    if (i < 0) {
        i = decodeIndex(i);
        if (rBuff.size() >= rBuff.maxSize())
            throw new StorageException("RecordBlock.put overflow");
        promotePage(path, this);
        rBuff.add(i, record);
    } else {
        r2 = rBuff.get(i);
        if (Record.compareByKeyValue(record, r2) != 0) {
            // Replace : return old
            promotePage(path, this);
            rBuff.set(i, record);
        } else
            // No promotion, no write
            return r2;
    }
    write();
    return r2;
}
Also used : Record(org.apache.jena.dboe.base.record.Record) StorageException(org.apache.jena.dboe.base.StorageException)

Example 53 with Record

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

the class BPlusTree method insertAndReturnOld.

/**
 * Add a record into the B+Tree
 */
public Record insertAndReturnOld(Record record) {
    startUpdateBlkMgr();
    BPTreeNode root = getRootWrite();
    Record r = BPTreeNode.insert(root, record);
    releaseRootWrite(root);
    finishUpdateBlkMgr();
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 54 with Record

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

the class BPlusTree method maxKey.

@Override
public Record maxKey() {
    startReadBlkMgr();
    BPTreeNode root = getRootRead();
    Record r = BPTreeNode.maxRecord(root);
    releaseRootRead(root);
    finishReadBlkMgr();
    return r;
}
Also used : Record(org.apache.jena.dboe.base.record.Record)

Example 55 with Record

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

the class BPlusTree method find.

@Override
public Record find(Record record) {
    startReadBlkMgr();
    BPTreeNode root = getRootRead();
    Record v = BPTreeNode.search(root, record);
    releaseRootRead(root);
    finishReadBlkMgr();
    return v;
}
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