STXXL
1.4.1
|
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
Definition at line 27 of file 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, unsigned int device_id=DEFAULT_DEVICE_ID) | |
Constructs file object. param filename_prefix filename prefix, numbering will be appended to it param mode open mode, see file::open_modes . More... | |
virtual | ~fileperblock_file () |
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... | |
virtual void | lock () |
Locks file for reading and writing (acquires a lock in the file system). More... | |
virtual void | serve (void *buffer, offset_type offset, size_type bytes, request::request_type type) |
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... | |
Public Member Functions inherited from stxxl::disk_queued_file | |
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=completion_handler()) |
request_ptr | awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler()) |
virtual int | get_allocator_id () const |
Returns the file's disk allocator number. More... | |
virtual int | get_queue_id () const |
Returns the identifier of the file's queue number. More... | |
Public Member Functions inherited from stxxl::file | |
file (unsigned int device_id=DEFAULT_DEVICE_ID) | |
Construct a new file, usually called by a subclass. More... | |
virtual | ~file () |
void | add_request_ref () |
increment referenced requests More... | |
virtual request_ptr | aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0 |
Schedules an asynchronous read request to the file. More... | |
virtual request_ptr | awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0 |
Schedules an asynchronous write request to the file. More... | |
virtual void | close_remove () |
close and remove file More... | |
void | delete_request_ref () |
decrement referenced requests More... | |
virtual void | discard (offset_type offset, offset_type size) |
Discard a region of the file (mark it unused). Some specialized file types may need to know freed regions. More... | |
virtual void | export_files (offset_type offset, offset_type length, std::string prefix) |
unsigned int | get_device_id () const |
Returns the file's physical device id. More... | |
unsigned_type | get_request_nref () |
return number of referenced requests More... | |
virtual void | serve (void *buffer, offset_type offset, size_type bytes, request::request_type type)=0 |
virtual void | set_size (offset_type newsize)=0 |
Changes the size of the file. More... | |
Protected Member Functions | |
std::string | filename_for_block (offset_type offset) |
Constructs a file name for a given block. More... | |
Private Attributes | |
offset_type | current_size |
std::string | filename_prefix |
base_file_type | lock_file |
bool | lock_file_created |
int | mode |
Additional Inherited Members | |
Public Types inherited from stxxl::file | |
typedef request::offset_type | offset_type |
the offset of a request, also the size of the file More... | |
enum | open_mode { RDONLY = 1, WRONLY = 2, RDWR = 4, CREAT = 8, DIRECT = 16, TRUNC = 32, SYNC = 64, NO_LOCK = 128, REQUIRE_DIRECT = 256 } |
Definition of acceptable file open modes. More... | |
typedef request::size_type | size_type |
the size of a request More... | |
Static Public Member Functions inherited from stxxl::file | |
static int | unlink (const char *path) |
unlink path from filesystem More... | |
static int | truncate (const char *path, external_size_type length) |
truncate a path to given length. Use this only if you dont have a fileio-specific object, which provides truncate(). More... | |
Static Public Attributes inherited from stxxl::file | |
static const unsigned int | DEFAULT_DEVICE_ID = (unsigned int)(-1) |
static const int | DEFAULT_LINUXAIO_QUEUE = -2 |
static const int | DEFAULT_QUEUE = -1 |
static const int | NO_ALLOCATOR = -1 |
Protected Attributes inherited from stxxl::file | |
unsigned int | m_device_id |
The file's physical device id (e.g. used for prefetching sequence calculation) More... | |
atomic_counted_object | m_request_ref |
count the number of requests referencing this file More... | |
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 , |
||
unsigned int | device_id = DEFAULT_DEVICE_ID |
||
) |
Constructs file object. param filename_prefix filename prefix, numbering will be appended to it param mode open mode, see file::open_modes
.
Definition at line 45 of file fileperblock_file.cpp.
|
virtual |
Definition at line 61 of file fileperblock_file.cpp.
References STXXL_ERRMSG.
|
virtual |
Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted.
Definition at line 109 of file fileperblock_file.cpp.
References STXXL_ERRMSG, stxxl::STXXL_UNUSED(), and STXXL_VERBOSE2.
|
virtual |
Rename the file corresponding to the offset such that it is out of reach for deleting.
Definition at line 124 of file fileperblock_file.cpp.
References STXXL_ERRMSG, STXXL_THROW_ERRNO, and stxxl::STXXL_UNUSED().
|
protected |
Constructs a file name for a given block.
Definition at line 71 of file fileperblock_file.cpp.
|
virtual |
Identifies the type of I/O implementation.
Implements stxxl::file.
Definition at line 145 of file fileperblock_file.cpp.
|
virtual |
Locks file for reading and writing (acquires a lock in the file system).
Implements stxxl::file.
Definition at line 89 of file fileperblock_file.cpp.
References STXXL_BLOCK_ALIGN, and stxxl::request_interface::wait().
Referenced by stxxl::create_file().
|
virtual |
Definition at line 80 of file fileperblock_file.cpp.
|
inlinevirtual |
Changes the size of the file.
new_size | value of the new file size |
Definition at line 58 of file fileperblock_file.h.
|
inlinevirtual |
Returns size of the file.
Implements stxxl::file.
Definition at line 62 of file fileperblock_file.h.
|
private |
Definition at line 32 of file fileperblock_file.h.
|
private |
Definition at line 30 of file fileperblock_file.h.
|
private |
Definition at line 34 of file fileperblock_file.h.
|
private |
Definition at line 33 of file fileperblock_file.h.
|
private |
Definition at line 31 of file fileperblock_file.h.