Search in sources :

Example 26 with Block

use of org.apache.jena.tdb.base.block.Block in project jena by apache.

the class RecordBufferPageMgr method getReadIterator.

public RecordBufferPage getReadIterator(int id) {
    Block block = blockMgr.getReadIterator(id);
    RecordBufferPage page = pageFactory.fromBlock(block);
    return page;
}
Also used : Block(org.apache.jena.tdb.base.block.Block) RecordBufferPage(org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)

Example 27 with Block

use of org.apache.jena.tdb.base.block.Block in project jena by apache.

the class BlockAccessMem method read.

@Override
public Block read(long id) {
    check(id);
    Block blk = blocks.get((int) id);
    if (safeModeThisMgr)
        return blk.replicate();
    else
        return blk;
}
Also used : Block(org.apache.jena.tdb.base.block.Block)

Example 28 with Block

use of org.apache.jena.tdb.base.block.Block in project jena by apache.

the class BlockAccessDirect method allocate.

@Override
public Block allocate(int blkSize) {
    if (blkSize > 0 && blkSize != this.blockSize)
        throw new FileException("Fixed blocksize only: request= " + blkSize + "fixed size=" + this.blockSize);
    int x = allocateId();
    ByteBuffer bb = ByteBuffer.allocate(blkSize);
    Block block = new Block(x, bb);
    return block;
}
Also used : Block(org.apache.jena.tdb.base.block.Block) ByteBuffer(java.nio.ByteBuffer)

Example 29 with Block

use of org.apache.jena.tdb.base.block.Block in project jena by apache.

the class BlockAccessDirect method read.

@Override
public Block read(long id) {
    check(id);
    checkIfClosed();
    ByteBuffer bb = ByteBuffer.allocate(blockSize);
    readByteBuffer(id, bb);
    bb.rewind();
    Block block = new Block(id, bb);
    return block;
}
Also used : Block(org.apache.jena.tdb.base.block.Block) ByteBuffer(java.nio.ByteBuffer)

Example 30 with Block

use of org.apache.jena.tdb.base.block.Block in project jena by apache.

the class PageBlockMgr method promote.

public void promote(Page page) {
    // Replace, reset Block in page.
    Block block = page.getBackingBlock();
    Block block2 = blockMgr.promote(block);
    if (block2 != block) {
        block2.setModified(true);
        // Change - reset Block in page.
        page.reset(block2);
    }
}
Also used : Block(org.apache.jena.tdb.base.block.Block)

Aggregations

Block (org.apache.jena.tdb.base.block.Block)42 ByteBuffer (java.nio.ByteBuffer)15 Test (org.junit.Test)11 BaseTest (org.apache.jena.atlas.junit.BaseTest)10 MappedByteBuffer (java.nio.MappedByteBuffer)2 TDBException (org.apache.jena.tdb.TDBException)2 Adler32 (java.util.zip.Adler32)1 BlockException (org.apache.jena.tdb.base.block.BlockException)1 BlockAccess (org.apache.jena.tdb.base.file.BlockAccess)1 ObjectFile (org.apache.jena.tdb.base.objectfile.ObjectFile)1 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)1 FileRef (org.apache.jena.tdb.sys.FileRef)1