Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
More...
#include <fileperblock_file.h>
|
| fileperblock_file (const std::string &filename_prefix, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR) |
| constructs file object More...
|
|
virtual void | serve (const request *req) throw (io_error) |
|
virtual void | set_size (offset_type new_size) |
| Changes the size of the file. More...
|
|
virtual offset_type | size () |
| Returns size of the file. More...
|
|
virtual void | lock () |
| Locks file for reading and writing (acquires a lock in the file system) More...
|
|
virtual void | discard (offset_type offset, offset_type length) |
| Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted. More...
|
|
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. More...
|
|
const char * | io_type () const |
| Identifies the type of I/O implementation. More...
|
|
| disk_queued_file (int queue_id, int allocator_id) |
|
request_ptr | aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl) |
| Schedules an asynchronous read request to the file. More...
|
|
request_ptr | awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl) |
| Schedules an asynchronous write request to the file. More...
|
|
virtual int | get_queue_id () const |
| Returns the identifier of the file's queue. More...
|
|
virtual int | get_allocator_id () const |
| Returns the file's allocator. More...
|
|
void | add_request_ref () |
|
void | delete_request_ref () |
|
int | get_request_nref () |
|
virtual int | get_physical_device_id () const |
|
virtual void | remove () |
|
|
enum | open_mode {
RDONLY = 1,
WRONLY = 2,
RDWR = 4,
CREAT = 8,
DIRECT = 16,
TRUNC = 32,
SYNC = 64,
NO_LOCK = 128
} |
| Definition of acceptable file open modes. More...
|
|
typedef request::offset_type | offset_type |
|
typedef request::size_type | size_type |
|
static const int | DEFAULT_QUEUE = -1 |
|
static const int | NO_QUEUE = -2 |
|
static const int | NO_ALLOCATOR = -1 |
|
template<class base_file_type>
class fileperblock_file< base_file_type >
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
template<class base_file_type >
__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
- Parameters
-
filename_prefix | filename prefix, numbering will be appended to it |
mode | open mode, see file::open_modes |
disk | disk(file) identifier |
template<class base_file_type >
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.
template<class base_file_type >
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.
template<class base_file_type >
std::string fileperblock_file< base_file_type >::filename_for_block |
( |
unsigned_type |
offset | ) |
|
|
protected |
Constructs a file name for a given block.
template<class base_file_type >
Identifies the type of I/O implementation.
- Returns
- pointer to null terminated string of characters, containing the name of I/O implementation
Reimplemented from file.
template<class base_file_type >
template<class base_file_type>
Changes the size of the file.
- Parameters
-
new_size | value of the new file size |
Implements file.
template<class base_file_type>
Returns size of the file.
- Returns
- file size in length
Implements file.
The documentation for this class was generated from the following files: