A class to manage writing and reading of block to disk. More...
#include <tpie/blocks/block_collection_cache.h>
Public Member Functions | |
block_collection_cache (std::string fileName, memory_size_type blockSize, memory_size_type maxSize, bool writeable) | |
Create a block collection. More... | |
block_handle | get_free_block () |
Allocates a new block. More... | |
void | free_block (block_handle handle) |
frees a block More... | |
block * | read_block (block_handle handle) |
Reads the content of a block from disk. More... | |
void | write_block (block_handle handle) |
Writes the content of a block to disk. More... | |
A class to manage writing and reading of block to disk.
Blocks are stored in an internal cache with a static size.
Definition at line 43 of file block_collection_cache.h.
tpie::blocks::block_collection_cache::block_collection_cache | ( | std::string | fileName, |
memory_size_type | blockSize, | ||
memory_size_type | maxSize, | ||
bool | writeable | ||
) |
Create a block collection.
fileName | the file in which blocks are saved |
blockSize | the size of blocks constructed |
writeable | indicates whether the collection is writeable |
maxSize | the size of the cache given in number of blocks |
void tpie::blocks::block_collection_cache::free_block | ( | block_handle | handle | ) |
frees a block
handle | the handle of the block to be freed |
block_handle tpie::blocks::block_collection_cache::get_free_block | ( | ) |
Allocates a new block.
block* tpie::blocks::block_collection_cache::read_block | ( | block_handle | handle | ) |
Reads the content of a block from disk.
handle | the handle of the block to read |
void tpie::blocks::block_collection_cache::write_block | ( | block_handle | handle | ) |
Writes the content of a block to disk.
handle | the handle of the block to write |