use of com.palantir.atlasdb.stream.BlockLoader in project atlasdb by palantir.
the class StreamTestWithHashStreamStore method makeStreamUsingTransaction.
private InputStream makeStreamUsingTransaction(Transaction parent, Long id, StreamMetadata metadata) {
BiConsumer<Long, OutputStream> singleBlockLoader = (index, destination) -> loadSingleBlockToOutputStream(parent, id, index, destination);
BlockGetter pageRefresher = new BlockLoader(singleBlockLoader, BLOCK_SIZE_IN_BYTES);
long totalBlocks = getNumberOfBlocksFromMetadata(metadata);
int blocksInMemory = getNumberOfBlocksThatFitInMemory();
try {
return BlockConsumingInputStream.create(pageRefresher, totalBlocks, blocksInMemory);
} catch (IOException e) {
throw Throwables.throwUncheckedException(e);
}
}
Aggregations