Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption. More...
#include <fileperblock_file.h>
Public Member Functions | |
fileperblock_file (const std::string &filename_prefix, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR) | |
constructs file object | |
virtual void | serve (const request *req) throw (io_error) |
virtual void | set_size (offset_type new_size) |
Changes the size of the file. | |
virtual offset_type | size () |
Returns size of the file. | |
virtual void | lock () |
Locks file for reading and writing (acquires a lock in the file system). | |
virtual void | discard (offset_type offset, offset_type length) |
Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted. | |
virtual void | export_files (offset_type offset, offset_type length, std::string filename) |
Rename the file corresponding to the offset such that it is out of reach for deleting. | |
const char * | io_type () const |
Identifies the type of I/O implementation. | |
Protected Member Functions | |
std::string | filename_for_block (unsigned_type offset) |
Constructs a file name for a given block. |
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
__STXXL_BEGIN_NAMESPACE fileperblock_file< base_file_type >::fileperblock_file | ( | const std::string & | filename_prefix, | |
int | mode, | |||
int | queue_id = DEFAULT_QUEUE , |
|||
int | allocator_id = NO_ALLOCATOR | |||
) |
constructs file object
filename_prefix | filename prefix, numbering will be appended to it | |
mode | open mode, see file::open_modes | |
disk | disk(file) identifier |
void fileperblock_file< base_file_type >::discard | ( | offset_type | offset, | |
offset_type | length | |||
) | [virtual] |
Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted.
Reimplemented from file.
References fileperblock_file< base_file_type >::filename_for_block().
void fileperblock_file< base_file_type >::export_files | ( | offset_type | offset, | |
offset_type | length, | |||
std::string | filename | |||
) | [virtual] |
Rename the file corresponding to the offset such that it is out of reach for deleting.
Reimplemented from file.
References fileperblock_file< base_file_type >::filename_for_block().
std::string fileperblock_file< base_file_type >::filename_for_block | ( | unsigned_type | offset | ) | [protected] |
Constructs a file name for a given block.
Referenced by fileperblock_file< base_file_type >::discard(), and fileperblock_file< base_file_type >::export_files().
const char * fileperblock_file< base_file_type >::io_type | ( | ) | const [virtual] |
Identifies the type of I/O implementation.
Reimplemented from file.
void fileperblock_file< base_file_type >::lock | ( | ) | [virtual] |
Locks file for reading and writing (acquires a lock in the file system).
Implements file.
virtual void fileperblock_file< base_file_type >::set_size | ( | offset_type | new_size | ) | [inline, virtual] |
virtual offset_type fileperblock_file< base_file_type >::size | ( | ) | [inline, virtual] |