Stxxl
1.4.0
|
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 | ~fileperblock_file () |
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. | |
Private Attributes | |
std::string | filename_prefix |
int | mode |
unsigned_type | current_size |
bool | lock_file_created |
base_file_type | lock_file |
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
Definition at line 28 of file fileperblock_file.h.
stxxl::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 |
Definition at line 28 of file fileperblock_file.cpp.
stxxl::fileperblock_file< base_file_type >::~fileperblock_file | ( | ) | [virtual] |
Definition at line 38 of file fileperblock_file.cpp.
void stxxl::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 stxxl::file.
Definition at line 84 of file fileperblock_file.cpp.
void stxxl::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 stxxl::file.
Definition at line 97 of file fileperblock_file.cpp.
std::string stxxl::fileperblock_file< base_file_type >::filename_for_block | ( | unsigned_type | offset | ) | [protected] |
Constructs a file name for a given block.
Definition at line 45 of file fileperblock_file.cpp.
const char * stxxl::fileperblock_file< base_file_type >::io_type | ( | ) | const [virtual] |
Identifies the type of I/O implementation.
Reimplemented from stxxl::file.
Definition at line 110 of file fileperblock_file.cpp.
void stxxl::fileperblock_file< base_file_type >::lock | ( | ) | [virtual] |
Locks file for reading and writing (acquires a lock in the file system)
Implements stxxl::file.
Definition at line 67 of file fileperblock_file.cpp.
References BLOCK_ALIGN, and stxxl::request_interface::wait().
Referenced by stxxl::create_file().
void stxxl::fileperblock_file< base_file_type >::serve | ( | const request * | req | ) | throw (io_error) [virtual] |
Implements stxxl::file.
Definition at line 54 of file fileperblock_file.cpp.
References dummy, and stxxl::request_interface::serve().
virtual void stxxl::fileperblock_file< base_file_type >::set_size | ( | offset_type | new_size | ) | [inline, virtual] |
Changes the size of the file.
new_size | value of the new file size |
Implements stxxl::file.
Definition at line 58 of file fileperblock_file.h.
virtual offset_type stxxl::fileperblock_file< base_file_type >::size | ( | ) | [inline, virtual] |
Returns size of the file.
Implements stxxl::file.
Definition at line 62 of file fileperblock_file.h.
unsigned_type stxxl::fileperblock_file< base_file_type >::current_size [private] |
Definition at line 33 of file fileperblock_file.h.
std::string stxxl::fileperblock_file< base_file_type >::filename_prefix [private] |
Definition at line 31 of file fileperblock_file.h.
base_file_type stxxl::fileperblock_file< base_file_type >::lock_file [private] |
Definition at line 35 of file fileperblock_file.h.
bool stxxl::fileperblock_file< base_file_type >::lock_file_created [private] |
Definition at line 34 of file fileperblock_file.h.
int stxxl::fileperblock_file< base_file_type >::mode [private] |
Definition at line 32 of file fileperblock_file.h.