use of org.apache.jena.tdb.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);
}
use of org.apache.jena.tdb.base.block.Block 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]);
}
}
use of org.apache.jena.tdb.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);
}
use of org.apache.jena.tdb.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));
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestBlockAccessFixedSize method fileaccess_05.
@Test(expected = FileException.class)
public void fileaccess_05() {
Block b1 = data(file, 10);
Block b2 = data(file, 20);
file.write(b1);
// Should not work. b2 not written.
Block b2a = file.read(b2.getId());
}
Aggregations