Search in sources :

Example 41 with Block

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

the class AbstractTestBlockMgr method file01.

@Test
public void file01() {
    Block block = blockMgr.allocate(BlkSize);
    ByteBuffer bb = block.getByteBuffer();
    fill(bb, (byte) 1);
    blockMgr.write(block);
    blockMgr.release(block);
}
Also used : Block(org.apache.jena.tdb.base.block.Block) ByteBuffer(java.nio.ByteBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 42 with Block

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

the class BlockMgrJournal method getWrite.

@Override
public Block getWrite(long id) {
    // NB: If we are in a stack of BlockMgrs, after a transaction has committed,
    // we would be called via getRead and the upper Blockgr does the promotion. 
    checkActive();
    checkIfClosed();
    Block block = localBlock(id);
    if (block != null)
        return block;
    // Get-as-read.
    block = blockMgr.getRead(id);
    // If most blocks get modified, then a copy is needed
    // anyway so now is as good a time as any.
    block = _promote(block);
    return block;
}
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