STXXL
1.4-dev
|
Implementation of file
based on the Linux kernel interface for asynchronous I/O.
Definition at line 34 of file linuxaio_file.h.
Public Member Functions | |
linuxaio_file (const std::string &filename, int mode, int queue_id=DEFAULT_LINUXAIO_QUEUE, int allocator_id=NO_ALLOCATOR, unsigned int device_id=DEFAULT_DEVICE_ID, int desired_queue_length=0) | |
Constructs file object. More... | |
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()) |
int | get_desired_queue_length () const |
const char * | io_type () const |
Identifies the type of I/O implementation. More... | |
void | serve (void *buffer, offset_type offset, size_type bytes, request::request_type type) |
Public Member Functions inherited from stxxl::ufs_file_base | |
~ufs_file_base () | |
void | close_remove () |
close and remove file More... | |
const char * | io_type () const |
Identifies the type of I/O implementation. More... | |
bool | is_device () const |
return true if file is special device node More... | |
void | lock () |
Locks file for reading and writing (acquires a lock in the file system). More... | |
void | set_size (offset_type newsize) |
offset_type | size () |
Returns size of the file. More... | |
void | unlink () |
unlink file without closing it. 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 () noexcept(false) |
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... | |
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... | |
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... | |
Private Attributes | |
int | desired_queue_length |
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 Member Functions inherited from stxxl::ufs_file_base | |
ufs_file_base (const std::string &filename, int mode) | |
void | _after_open () |
void | _set_size (offset_type newsize) |
offset_type | _size () |
void | close () |
Protected Attributes inherited from stxxl::ufs_file_base | |
mutex | fd_mutex |
int | file_des |
const std::string | filename |
bool | m_is_device |
is special device node More... | |
int | m_mode |
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... | |
|
inline |
Constructs file object.
filename | path of file |
mode | open mode, see stxxl::file::open_modes |
queue_id | disk queue identifier |
allocator_id | linked disk_allocator |
device_id | physical device identifier |
desired_queue_length | queue length requested from kernel |
Definition at line 49 of file linuxaio_file.h.
request_ptr stxxl::linuxaio_file::aread | ( | void * | buffer, |
offset_type | pos, | ||
size_type | bytes, | ||
const completion_handler & | on_cmpl = completion_handler() |
||
) |
Definition at line 22 of file linuxaio_file.cpp.
request_ptr stxxl::linuxaio_file::awrite | ( | void * | buffer, |
offset_type | pos, | ||
size_type | bytes, | ||
const completion_handler & | on_cmpl = completion_handler() |
||
) |
Definition at line 35 of file linuxaio_file.cpp.
|
inline |
Definition at line 69 of file linuxaio_file.h.
|
virtual |
Identifies the type of I/O implementation.
Implements stxxl::file.
Definition at line 58 of file linuxaio_file.cpp.
void stxxl::linuxaio_file::serve | ( | void * | buffer, |
offset_type | offset, | ||
size_type | bytes, | ||
request::request_type | type | ||
) |
Definition at line 48 of file linuxaio_file.cpp.
References stxxl::request_interface::wait().
|
private |
Definition at line 39 of file linuxaio_file.h.