Search in sources :

Example 11 with Block

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

the class PageBlockMgr method create.

/**
 * Allocate a new thing
 */
public T create(BlockType bType) {
    Block block = blockMgr.allocate(-1);
    block.setModified(true);
    T page = pageFactory.createFromBlock(block, bType);
    return page;
}
Also used : Block(org.apache.jena.dboe.base.block.Block)

Example 12 with Block

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

the class PageBlockMgr method free.

public void free(Page page) {
    Block block = page.getBackingBlock();
    blockMgr.free(block);
}
Also used : Block(org.apache.jena.dboe.base.block.Block)

Example 13 with Block

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

the class AbstractTestBlockAccessFixedSize method fileaccess_03.

@Test
public void fileaccess_03() {
    Block b1 = data(file, blkSize);
    file.write(b1);
    long x = b1.getId();
    Block b9 = file.read(x);
    assertNotSame(b1, b9);
    assertTrue(sameValue(b1, b9));
    b9 = file.read(x);
    assertNotSame(b1, b9);
    assertTrue(sameValue(b1, b9));
}
Also used : Block(org.apache.jena.dboe.base.block.Block) Test(org.junit.Test)

Example 14 with Block

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

the class AbstractTestBlockAccessFixedSize method fileaccess_02.

@Test
public void fileaccess_02() {
    Block b = data(file, blkSize);
    file.write(b);
}
Also used : Block(org.apache.jena.dboe.base.block.Block) Test(org.junit.Test)

Example 15 with Block

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

the class AbstractTestBlockAccessVarSize method fileaccess_50.

@Test
public void fileaccess_50() {
    BlockAccess file = make();
    Block b1 = data(file, 10);
    Block b2 = data(file, 20);
    file.write(b1);
    file.write(b2);
    Block b1a = file.read(b1.getId());
    Block b2a = file.read(b2.getId());
    assertNotSame(b1a, b1);
    assertNotSame(b2a, b2);
    sameValue(b1, b1a);
    sameValue(b2, b2a);
}
Also used : Block(org.apache.jena.dboe.base.block.Block) Test(org.junit.Test)

Aggregations

Block (org.apache.jena.dboe.base.block.Block)24 ByteBuffer (java.nio.ByteBuffer)7 Test (org.junit.Test)5 MappedByteBuffer (java.nio.MappedByteBuffer)2 InternalErrorException (org.apache.jena.atlas.lib.InternalErrorException)1