Search in sources :

Example 1 with ObjectFile

use of org.apache.jena.tdb.base.objectfile.ObjectFile in project jena by apache.

the class dumpnodes method exec.

@Override
protected void exec() {
    Location loc = modLocation.getLocation();
    ObjectFile objFile = determineNodeTable(loc);
    dump(System.out, objFile);
}
Also used : ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) Location(org.apache.jena.tdb.base.file.Location) ModLocation(tdb.cmdline.ModLocation)

Example 2 with ObjectFile

use of org.apache.jena.tdb.base.objectfile.ObjectFile in project jena by apache.

the class TestTransRestart method countRDFNodes.

// Only call when the dataset is not in TDBMaker or in StoreConnection
private int countRDFNodes() {
    ObjectFile objects = FileFactory.createObjectFileDisk(location.getPath(Names.indexId2Node, Names.extNodeData));
    int count = 0;
    Iterator<Pair<Long, ByteBuffer>> iter = objects.all();
    while (iter.hasNext()) {
        iter.next();
        count++;
    }
    objects.close();
    return count;
}
Also used : ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) Pair(org.apache.jena.atlas.lib.Pair)

Example 3 with ObjectFile

use of org.apache.jena.tdb.base.objectfile.ObjectFile in project jena by apache.

the class TestObjectFileBuffering method writePrealloc.

private void writePrealloc(int sizeOfBuffer, int... sizes) {
    ObjectFile file = make(sizeOfBuffer);
    int N = sizes.length;
    Block[] blocks = new Block[N];
    ByteBuffer[] read = new ByteBuffer[N];
    for (int i = 0; i < N; i++) {
        blocks[i] = file.allocWrite(sizes[i]);
        fill(blocks[i].getByteBuffer());
        file.completeWrite(blocks[i]);
    }
    for (int i = 0; i < N; i++) {
        read[i] = file.read(blocks[i].getId());
        assertNotSame(blocks[i].getByteBuffer(), read[i]);
        sameValue(blocks[i].getByteBuffer(), read[i]);
    }
}
Also used : ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) Block(org.apache.jena.tdb.base.block.Block) ByteBuffer(java.nio.ByteBuffer)

Example 4 with ObjectFile

use of org.apache.jena.tdb.base.objectfile.ObjectFile in project jena by apache.

the class TestObjectFileBuffering method write.

private void write(int sizeOfBuffer, int... sizes) {
    ObjectFile file = make(sizeOfBuffer);
    int N = sizes.length;
    ByteBuffer[] bb = new ByteBuffer[N];
    long[] loc = new long[N];
    ByteBuffer[] read = new ByteBuffer[N];
    for (int i = 0; i < N; i++) {
        bb[i] = ByteBuffer.allocate(sizes[i]);
        fill(bb[i]);
        loc[i] = file.write(bb[i]);
    }
    //file.sync() ;
    for (int i = 0; i < N; i++) {
        read[i] = file.read(loc[i]);
        assertNotSame(bb[i], read[i]);
        sameValue(bb[i], read[i]);
    }
}
Also used : ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) ByteBuffer(java.nio.ByteBuffer)

Example 5 with ObjectFile

use of org.apache.jena.tdb.base.objectfile.ObjectFile in project jena by apache.

the class AbstractTestNodeTableTrans method create.

private NodeTableTrans create(Transaction txn, NodeTable base) {
    RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId);
    Index idx = new IndexMap(recordFactory);
    ObjectFile objectFile = createObjectFile();
    NodeTableTrans ntt = new NodeTableTrans(txn, "test", base, idx, objectFile);
    return ntt;
}
Also used : NodeTableTrans(org.apache.jena.tdb.transaction.NodeTableTrans) RecordFactory(org.apache.jena.tdb.base.record.RecordFactory) IndexMap(org.apache.jena.tdb.index.IndexMap) ObjectFile(org.apache.jena.tdb.base.objectfile.ObjectFile) Index(org.apache.jena.tdb.index.Index)

Aggregations

ObjectFile (org.apache.jena.tdb.base.objectfile.ObjectFile)9 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)3 ByteBuffer (java.nio.ByteBuffer)2 Index (org.apache.jena.tdb.index.Index)2 IndexMap (org.apache.jena.tdb.index.IndexMap)2 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)2 File (java.io.File)1 Pair (org.apache.jena.atlas.lib.Pair)1 Block (org.apache.jena.tdb.base.block.Block)1 BufferChannelFile (org.apache.jena.tdb.base.file.BufferChannelFile)1 FileSet (org.apache.jena.tdb.base.file.FileSet)1 Location (org.apache.jena.tdb.base.file.Location)1 BuilderStdIndex (org.apache.jena.tdb.index.BuilderStdIndex)1 RangeIndex (org.apache.jena.tdb.index.RangeIndex)1 StoreParams (org.apache.jena.tdb.setup.StoreParams)1 NodeTableNative (org.apache.jena.tdb.store.nodetable.NodeTableNative)1 TupleIndex (org.apache.jena.tdb.store.tupletable.TupleIndex)1 NodeTableTrans (org.apache.jena.tdb.transaction.NodeTableTrans)1 ModLocation (tdb.cmdline.ModLocation)1