Search in sources :

Example 6 with StorageException

use of org.apache.jena.dboe.base.StorageException 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)

Aggregations

StorageException (org.apache.jena.dboe.base.StorageException)6 Record (org.apache.jena.dboe.base.record.Record)2