Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
disk_queued_file Class Reference

Detailed Description

Implementation of some file methods based on serving_request.

Definition at line 27 of file disk_queued_file.hpp.

+ Inheritance diagram for disk_queued_file:
+ Collaboration diagram for disk_queued_file:

#include <disk_queued_file.hpp>

Public Member Functions

 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
 
- 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...
 
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)
 
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_statsget_file_stats () const
 
size_t get_request_nref ()
 return number of referenced requests More...
 
virtual const char * io_type () const =0
 
virtual void lock ()=0
 Locks file for reading and writing (acquires a lock in the file system). More...
 
bool need_alignment () const
 Returns need_alignment_. More...
 
fileoperator= (const file &)=delete
 non-copyable: delete assignment operator More...
 
fileoperator= (file &&)=default
 move-assignment operator: default More...
 
virtual void serve (void *buffer, offset_type offset, size_type bytes, request::read_or_write op)=0
 
virtual void set_size (offset_type newsize)=0
 
virtual offset_type size ()=0
 
- 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...
 
ReferenceCounteroperator= (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...
 

Private Attributes

int allocator_id_
 
int queue_id_
 

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 Attributes inherited from file
unsigned int device_id_
 
file_statsfile_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...
 

Constructor & Destructor Documentation

disk_queued_file ( int  queue_id,
int  allocator_id 
)
inline

Definition at line 32 of file disk_queued_file.hpp.

Member Function Documentation

request_ptr aread ( void *  buffer,
offset_type  pos,
size_type  bytes,
const completion_handler on_complete = completion_handler() 
)
overridevirtual

Schedules an asynchronous read request to the file.

Parameters
bufferpointer to memory buffer to read into
posfile position to start read from
bytesnumber of bytes to transfer
on_completeI/O completion handler
Returns
request_ptr request object, which can be used to track the status of the operation

Implements file.

Definition at line 23 of file disk_queued_file.cpp.

References disk_queues::add_request(), bytes, singleton< disk_queues >::get_instance(), disk_queued_file::get_queue_id(), and request_interface::READ.

request_ptr awrite ( void *  buffer,
offset_type  pos,
size_type  bytes,
const completion_handler on_complete = completion_handler() 
)
overridevirtual

Schedules an asynchronous write request to the file.

Parameters
bufferpointer to memory buffer to write from
posstarting file position to write
bytesnumber of bytes to transfer
on_completeI/O completion handler
Returns
request_ptr request object, which can be used to track the status of the operation

Implements file.

Definition at line 36 of file disk_queued_file.cpp.

References disk_queues::add_request(), bytes, singleton< disk_queues >::get_instance(), disk_queued_file::get_queue_id(), and request_interface::WRITE.

int get_allocator_id ( ) const
inlineoverridevirtual

Returns the file's parallel disk block allocator number.

Implements file.

Definition at line 49 of file disk_queued_file.hpp.

References disk_queued_file::allocator_id_.

int get_queue_id ( ) const
inlineoverridevirtual

Returns the identifier of the file's queue number.

Remarks
Files allocated on the same physical device usually share the same queue, unless there is a common queue (e.g. with linuxaio).

Implements file.

Definition at line 44 of file disk_queued_file.hpp.

References disk_queued_file::queue_id_.

Referenced by disk_queued_file::aread(), and disk_queued_file::awrite().

Member Data Documentation

int allocator_id_
private

Definition at line 29 of file disk_queued_file.hpp.

Referenced by disk_queued_file::get_allocator_id().

int queue_id_
private

Definition at line 29 of file disk_queued_file.hpp.

Referenced by disk_queued_file::get_queue_id().


The documentation for this class was generated from the following files: