STXXL
1.4.0
|
Defines interface of file.
It is a base class for different implementations that might base on various file systems or even remote storage interfaces
Public Types | |
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... | |
Public Member Functions | |
virtual | ~file () |
void | add_request_ref () |
virtual request_ptr | aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl)=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)=0 |
Schedules an asynchronous write request to the file. More... | |
virtual void | close_remove () |
close and remove file More... | |
void | delete_request_ref () |
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) |
virtual int | get_allocator_id () const =0 |
Returns the file's allocator. More... | |
virtual int | get_physical_device_id () const |
virtual int | get_queue_id () const =0 |
Returns the identifier of the file's queue. More... | |
int | get_request_nref () |
virtual const char * | io_type () const |
Identifies the type of I/O implementation. More... | |
virtual void | lock ()=0 |
Locks file for reading and writing (acquires a lock in the file system). More... | |
virtual void | serve (const request *req)=0 throw (io_error) |
virtual void | set_size (offset_type newsize)=0 |
Changes the size of the file. More... | |
virtual offset_type | size ()=0 |
Returns size of the file. More... | |
Static Public Member Functions | |
Static Functions for Platform Abstraction | |
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 | |
static const int | DEFAULT_QUEUE = -1 |
static const int | NO_ALLOCATOR = -1 |
static const int | NO_QUEUE = -2 |
Protected Member Functions | |
file () | |
Initializes file object. More... | |
Private Attributes | |
int | request_ref_cnt |
mutex | request_ref_cnt_mutex |
Additional Inherited Members | |
Private Member Functions inherited from stxxl::noncopyable | |
noncopyable () | |
typedef request::offset_type stxxl::file::offset_type |
Definition of acceptable file open modes.
Various open modes in a file system must be converted to this set of acceptable modes
|
inlineprotected |
|
inlinevirtual |
Definition at line 172 of file file.h.
References STXXL_ERRMSG.
|
inline |
Definition at line 110 of file file.h.
Referenced by stxxl::request::request().
|
pure virtual |
Schedules an asynchronous read request to the file.
buffer | pointer to memory buffer to read into |
pos | file position to start read from |
bytes | number of bytes to transfer |
on_cmpl | I/O completion handler |
request_ptr
request object, which can be used to track the status of the operation Referenced by stxxl::typed_block< RawSize, Type, NRef, MetaInfoType >::read().
|
pure virtual |
Schedules an asynchronous write request to the file.
buffer | pointer to memory buffer to write from |
pos | starting file position to write |
bytes | number of bytes to transfer |
on_cmpl | I/O completion handler |
request_ptr
request object, which can be used to track the status of the operation Referenced by stxxl::typed_block< RawSize, Type, NRef, MetaInfoType >::write().
|
inlinevirtual |
close and remove file
Reimplemented in stxxl::wfs_file_base, and stxxl::ufs_file_base.
|
inline |
Definition at line 116 of file file.h.
Referenced by stxxl::request::completed().
|
inlinevirtual |
Discard a region of the file (mark it unused). Some specialized file types may need to know freed regions.
Definition at line 156 of file file.h.
References stxxl::STXXL_UNUSED().
|
inlinevirtual |
Definition at line 162 of file file.h.
References stxxl::STXXL_UNUSED().
|
pure virtual |
Returns the file's allocator.
Implemented in stxxl::disk_queued_file.
Referenced by stxxl::serving_request::serve().
|
inlinevirtual |
|
pure virtual |
Returns the identifier of the file's queue.
Implemented in stxxl::disk_queued_file.
|
inlinevirtual |
Identifies the type of I/O implementation.
Reimplemented in stxxl::sim_disk_file, stxxl::wbtl_file, stxxl::fileperblock_file< base_file_type >, stxxl::wincall_file, stxxl::wfs_file_base, stxxl::ufs_file_base, stxxl::mem_file, stxxl::mmap_file, and stxxl::syscall_file.
Definition at line 181 of file file.h.
Referenced by stxxl::serving_request::io_type().
|
pure virtual |
Locks file for reading and writing (acquires a lock in the file system).
Implemented in stxxl::wbtl_file, stxxl::fileperblock_file< base_file_type >, stxxl::wfs_file_base, stxxl::ufs_file_base, and stxxl::mem_file.
Implemented in stxxl::sim_disk_file, stxxl::wbtl_file, stxxl::wincall_file, stxxl::fileperblock_file< base_file_type >, stxxl::mmap_file, stxxl::syscall_file, and stxxl::mem_file.
Referenced by stxxl::serving_request::serve().
|
pure virtual |
Changes the size of the file.
newsize | new file size |
Referenced by stxxl::vector< ValueType >::vector().
|
pure virtual |
Returns size of the file.
Implemented in stxxl::wbtl_file, stxxl::fileperblock_file< base_file_type >, stxxl::wfs_file_base, stxxl::ufs_file_base, and stxxl::mem_file.
|
static |
truncate a path to given length. Use this only if you dont have a fileio-specific object, which provides truncate().
|
static |
|
static |
Definition at line 86 of file file.h.
Referenced by stxxl::disk_config::fileio_string(), and stxxl::disk_config::parse_line().