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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations