Search in sources :

Example 56 with Record

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

the class TestRecordBuffer method recBufferIterate03.

@Test
public void recBufferIterate03() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator(intToRecord(4), null);
    same(iter, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 57 with Record

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

the class NodeTableTrans method dump.

// Debugging only
private void dump() {
    System.err.println(">>>>>>>>>>");
    System.err.println("label = " + label);
    System.err.println("txn = " + txn);
    System.err.println("offset = " + allocOffset);
    System.err.println("journalStartOffset = " + journalObjFileStartOffset);
    System.err.println("journal = " + journalObjFile.getLabel());
    if (true)
        return;
    System.err.println("nodeTableJournal >>>");
    Iterator<Pair<NodeId, Node>> iter = nodeTableJournal.all();
    for (; iter.hasNext(); ) {
        Pair<NodeId, Node> x = iter.next();
        NodeId nodeId = x.getLeft();
        Node node = x.getRight();
        NodeId mapped = mapFromJournal(nodeId);
        //debug("append: %s -> %s", x, mapFromJournal(nodeId)) ;
        // This does the write.
        NodeId nodeId2 = base.getAllocateNodeId(node);
        System.err.println(x + "  mapped=" + mapped + " getAlloc=" + nodeId2);
    }
    System.err.println("journal >>>");
    Iterator<Pair<Long, ByteBuffer>> iter1 = this.journalObjFile.all();
    for (; iter1.hasNext(); ) {
        Pair<Long, ByteBuffer> p = iter1.next();
        System.err.println(p.getLeft() + " : " + p.getRight());
        ByteBufferLib.print(System.err, p.getRight());
    }
    System.err.println("nodeIndex >>>");
    Iterator<Record> iter2 = this.nodeIndex.iterator();
    for (; iter2.hasNext(); ) {
        Record r = iter2.next();
        System.err.println(r);
    }
    System.err.println("<<<<<<<<<<");
}
Also used : Node(org.apache.jena.graph.Node) NodeId(org.apache.jena.tdb.store.NodeId) Record(org.apache.jena.tdb.base.record.Record) ByteBuffer(java.nio.ByteBuffer) Pair(org.apache.jena.atlas.lib.Pair)

Example 58 with Record

use of org.apache.jena.tdb.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.tdb.base.record.Record)

Example 59 with Record

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

the class BPTreeRecords method internalDelete.

@Override
public Record internalDelete(Record record) {
    promote();
    int i = rBuff.find(record);
    if (i < 0)
        return null;
    Record r2 = rBuff.get(i);
    rBuff.remove(i);
    write();
    return r2;
}
Also used : Record(org.apache.jena.tdb.base.record.Record)

Example 60 with Record

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

the class BPlusTree method maxKey.

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

Aggregations

Record (org.apache.jena.tdb.base.record.Record)95 Test (org.junit.Test)20 RecordLib.intToRecord (org.apache.jena.tdb.base.record.RecordLib.intToRecord)15 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)14 BaseTest (org.apache.jena.atlas.junit.BaseTest)10 RangeIndex (org.apache.jena.tdb.index.RangeIndex)8 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)6 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)6 NoSuchElementException (java.util.NoSuchElementException)5 FileSet (org.apache.jena.tdb.base.file.FileSet)5 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)5 NodeId (org.apache.jena.tdb.store.NodeId)5 Pair (org.apache.jena.atlas.lib.Pair)4 Location (org.apache.jena.tdb.base.file.Location)4 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 StorageException (org.apache.jena.tdb.base.StorageException)3 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)3 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)3 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)3