use of org.apache.jena.tdb.base.record.Record in project jena by apache.
the class BPTreeNode method minRecord.
@Override
protected Record minRecord() {
BPTreePage page = get(0, READ);
Record r = page.minRecord();
page.release();
return r;
}
use of org.apache.jena.tdb.base.record.Record in project jena by apache.
the class BPTreeNode method search.
// ---------- Public calls.
// None of these are called recursively.
/** Find a record, using the active comparator */
public static Record search(BPTreeNode root, Record rec) {
root.internalCheckNodeDeep();
if (root.id != 0)
throw new BPTreeException("Search not starting from the root: " + root);
Record r = root.internalSearch(rec);
return r;
}
use of org.apache.jena.tdb.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(Record rec) {
if (CheckingNode)
internalCheckNode();
BPTreePage page = findHere(rec);
Record r = page.internalSearch(rec);
page.release();
return r;
}
use of org.apache.jena.tdb.base.record.Record in project jena by apache.
the class BPTreeNode method internalDelete.
// ============ DELETE
/* Delete
* Descend, making sure that the node is not minimum size at each descend.
* If it is, rebalenace.
*/
@Override
final Record internalDelete(Record rec) {
internalCheckNode();
if (logging())
log.debug(format("internalDelete(%s) : %s", rec, this));
int x = findSlot(rec);
// If x is >= 0, may need to adjust this
int y = convert(x);
BPTreePage page = get(y, READ);
boolean thisWriteNeeded = false;
if (// Can't be root - we decended in the get().
page.isMinSize()) {
promote();
page = rebalance(page, y);
thisWriteNeeded = true;
// May have moved/removed at x. Find again. YUK.
x = findSlot(rec);
if (CheckingNode) {
internalCheckNode();
page.checkNode();
}
this.write();
}
// Go to bottom
// Need to return the new key.
Record r2 = page.internalDelete(rec);
if (x >= 0) {
promote();
// YUK
records.set(x, keyRecord(page.maxRecord()));
this.write();
}
page.release();
return r2;
}
use of org.apache.jena.tdb.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;
}
Aggregations