Thrill
0.1
|
Implementation of file based on UNIX syscalls.
Definition at line 30 of file syscall_file.hpp.
#include <syscall_file.hpp>
Public Member Functions | |
syscall_file (const std::string &filename, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR, unsigned int device_id=DEFAULT_DEVICE_ID, file_stats *file_stats=nullptr) | |
const char * | io_type () const final |
void | serve (void *buffer, offset_type offset, size_type bytes, request::read_or_write op) final |
Public Member Functions inherited from ufs_file_base | |
~ufs_file_base () | |
void | close_remove () final |
close and remove file More... | |
const char * | io_type () const override |
bool | is_device () const |
return true if file is special device node More... | |
void | lock () final |
Locks file for reading and writing (acquires a lock in the file system). More... | |
void | set_size (offset_type newsize) final |
offset_type | size () final |
void | unlink () |
unlink file without closing it. More... | |
Public Member Functions inherited from file | |
file (unsigned int device_id=DEFAULT_DEVICE_ID, file_stats *file_stats=nullptr) | |
Construct a new file, usually called by a subclass. More... | |
file (const file &)=delete | |
non-copyable: delete copy-constructor More... | |
file (file &&)=default | |
move-constructor: default More... | |
virtual | ~file () |
void | add_request_ref () |
increment referenced requests More... | |
void | delete_request_ref () |
decrement referenced requests More... | |
virtual void | discard (offset_type offset, offset_type size) |
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... | |
file_stats * | get_file_stats () const |
size_t | get_request_nref () |
return number of referenced requests More... | |
bool | need_alignment () const |
Returns need_alignment_. More... | |
file & | operator= (const file &)=delete |
non-copyable: delete assignment operator More... | |
file & | operator= (file &&)=default |
move-assignment operator: default More... | |
Public Member Functions inherited from ReferenceCounter | |
ReferenceCounter () noexcept | |
new objects have zero reference count More... | |
ReferenceCounter (const ReferenceCounter &) noexcept | |
coping still creates a new object with zero reference count More... | |
~ReferenceCounter () | |
bool | dec_reference () const noexcept |
Call whenever resetting (i.e. More... | |
void | inc_reference () const noexcept |
Call whenever setting a pointer to the object. More... | |
ReferenceCounter & | operator= (const ReferenceCounter &) noexcept |
assignment operator, leaves pointers unchanged More... | |
size_t | reference_count () const noexcept |
Return the number of references to this object (for debugging) More... | |
bool | unique () const noexcept |
Test if the ReferenceCounter is referenced by only one CountingPtr. More... | |
Public Member Functions inherited from 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_complete=completion_handler()) override |
request_ptr | awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_complete=completion_handler()) override |
int | get_allocator_id () const override |
Returns the file's parallel disk block allocator number. More... | |
int | get_queue_id () const override |
Additional Inherited Members | |
Public Types inherited from file | |
using | offset_type = request::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 } |
using | size_type = request::size_type |
the size of a request More... | |
Static Public Member Functions inherited from file | |
static int | unlink (const char *path) |
unlink path from filesystem More... | |
static int | truncate (const char *path, external_size_type length) |
Static Public Attributes inherited from file | |
static const unsigned int | DEFAULT_DEVICE_ID = std::numeric_limits<unsigned int>::max() |
static const int | DEFAULT_LINUXAIO_QUEUE = -2 |
static const int | DEFAULT_QUEUE = -1 |
static const int | NO_ALLOCATOR = -1 |
Protected Member Functions inherited from 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 ufs_file_base | |
std::mutex | fd_mutex_ |
int | file_des_ |
const std::string | filename_ |
bool | is_device_ |
is special device node More... | |
int | mode_ |
Protected Attributes inherited from file | |
unsigned int | device_id_ |
file_stats * | file_stats_ |
bool | need_alignment_ = false |
Flag whether read/write operations REQUIRE alignment. More... | |
tlx::reference_counter | request_ref_ |
count the number of requests referencing this file More... | |
|
inline |
Constructs file object.
filename | path of file |
mode | open mode, see foxxll::file::open_modes |
queue_id | disk queue identifier |
allocator_id | linked disk_allocator |
device_id | physical device identifier |
file_stats | file-specific stats |
Definition at line 40 of file syscall_file.hpp.
References bytes, syscall_file::io_type(), and syscall_file::serve().
|
finalvirtual |
Identifies the type of I/O implementation.
Implements file.
Definition at line 120 of file syscall_file.cpp.
Referenced by syscall_file::syscall_file().
|
finalvirtual |
Implements file.
Definition at line 28 of file syscall_file.cpp.
References ufs_file_base::_size(), ufs_file_base::fd_mutex_, ufs_file_base::file_des_, file::file_stats_, ufs_file_base::filename_, FOXXLL_THROW_ERRNO, max(), request_interface::READ, and request_interface::WRITE.
Referenced by syscall_file::syscall_file().