Thrill  0.1

Detailed Description

Request object encapsulating basic properties like file and offset.

Definition at line 49 of file request.hpp.

+ Inheritance diagram for request:
+ Collaboration diagram for request:

#include <request.hpp>

Public Member Functions

 request (const completion_handler &on_complete, file *file, void *buffer, offset_type offset, size_type bytes, read_or_write op)
 
 request (const request &)=delete
 non-copyable: delete copy-constructor More...
 
 request (request &&)=default
 move-constructor: default More...
 
virtual ~request ()
 
requestoperator= (const request &)=delete
 non-copyable: delete assignment operator More...
 
requestoperator= (request &&)=default
 move-assignment operator: default More...
 
Accessors
fileget_file () const
 
void * buffer () const
 
offset_type offset () const
 
size_type bytes () const
 
read_or_write op () const
 
void check_alignment () const
 
std::ostream & print (std::ostream &out) const final
 Dumps properties of a request. More...
 
void error_occured (const char *msg)
 
void error_occured (const std::string &msg)
 
void check_errors ()
 Rises an exception if there were error with the I/O. More...
 
const char * io_type () const override
 Identifies the type of I/O implementation. More...
 
void release_file_reference ()
 
- Public Member Functions inherited from request_interface
 request_interface ()=default
 
 request_interface (const request_interface &)=delete
 non-copyable: delete copy-constructor More...
 
virtual ~request_interface ()
 
virtual bool add_waiter (onoff_switch *sw)=0
 
virtual bool cancel ()=0
 Cancel a request. More...
 
virtual void delete_waiter (onoff_switch *sw)=0
 
request_interfaceoperator= (const request_interface &)=delete
 non-copyable: delete assignment operator More...
 
virtual bool poll ()=0
 
virtual void wait (bool measure_time=true)=0
 Suspends calling thread until completion of the request. 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...
 
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...
 

Protected Member Functions

void check_nref (bool after=false)
 
- Protected Member Functions inherited from request_interface
virtual void completed (bool canceled)=0
 
virtual void notify_waiters ()=0
 

Protected Attributes

std::unique_ptr< io_errorerror_
 
completion_handler on_complete_
 
Base Parameter of an I/O Request
filefile_
 file implementation to perform I/O with More...
 
void * buffer_
 data buffer to transfer More...
 
offset_type offset_
 offset within file More...
 
size_type bytes_
 number of bytes at buffer_ to transfer More...
 
read_or_write op_
 READ or WRITE. More...
 

Private Member Functions

void check_nref_failed (bool after)
 

Static Private Attributes

static constexpr bool debug = false
 

Additional Inherited Members

- Public Types inherited from request_interface
using offset_type = uint64_t
 type for offsets within a file More...
 
enum  read_or_write { READ, WRITE }
 
using size_type = size_t
 type for block transfer sizes More...
 

Constructor & Destructor Documentation

◆ request() [1/3]

request ( const completion_handler on_complete,
file file,
void *  buffer,
offset_type  offset,
size_type  bytes,
read_or_write  op 
)

◆ request() [2/3]

request ( const request )
delete

non-copyable: delete copy-constructor

◆ request() [3/3]

request ( request &&  )
default

move-constructor: default

◆ ~request()

~request ( )
virtual

Definition at line 35 of file request.cpp.

References ReferenceCounter::reference_count(), and TLX_LOG.

Member Function Documentation

◆ buffer()

void* buffer ( ) const
inline

Definition at line 96 of file request.hpp.

References request::buffer_.

◆ bytes()

size_type bytes ( ) const
inline

Definition at line 98 of file request.hpp.

References request::bytes_.

◆ check_alignment()

void check_alignment ( ) const

◆ check_errors()

void check_errors ( )
inline

Rises an exception if there were error with the I/O.

Definition at line 114 of file request.hpp.

References request::io_type(), and request::release_file_reference().

Referenced by BlockPool::OnReadComplete(), BlockPool::OnWriteComplete(), request_with_state::poll(), and request_with_state::wait().

◆ check_nref()

void check_nref ( bool  after = false)
inlineprotected

◆ check_nref_failed()

void check_nref_failed ( bool  after)
private

◆ error_occured() [1/2]

void error_occured ( const char *  msg)

Inform the request object that an error occurred during the I/O execution.

Definition at line 80 of file request.cpp.

References request::error_.

Referenced by request::op(), and serving_request::serve().

◆ error_occured() [2/2]

void error_occured ( const std::string &  msg)

Inform the request object that an error occurred during the I/O execution.

Definition at line 85 of file request.cpp.

References request::error_.

◆ get_file()

file* get_file ( ) const
inline

Definition at line 95 of file request.hpp.

References request::file_.

◆ io_type()

const char * io_type ( ) const
overridevirtual

Identifies the type of I/O implementation.

Returns
pointer to null terminated string of characters, containing the name of I/O implementation

Implements request_interface.

Reimplemented in serving_request.

Definition at line 90 of file request.cpp.

References request::file_, and file::io_type().

Referenced by request::check_errors().

◆ offset()

offset_type offset ( ) const
inline

Definition at line 97 of file request.hpp.

References request::offset_.

◆ op()

read_or_write op ( ) const
inline

◆ operator=() [1/2]

request& operator= ( const request )
delete

non-copyable: delete assignment operator

◆ operator=() [2/2]

request& operator= ( request &&  )
default

move-assignment operator: default

◆ print()

std::ostream & print ( std::ostream &  out) const
finalvirtual

Dumps properties of a request.

Implements request_interface.

Definition at line 70 of file request.cpp.

References request::buffer_, request::bytes_, request::file_, request::offset_, request::op_, and request_interface::READ.

Referenced by request::op(), and foxxll::operator<<().

◆ release_file_reference()

void release_file_reference ( )

Member Data Documentation

◆ buffer_

void* buffer_
protected

◆ bytes_

size_type bytes_
protected

number of bytes at buffer_ to transfer

Definition at line 69 of file request.hpp.

Referenced by request::bytes(), request::check_alignment(), request::check_nref_failed(), request::print(), and serving_request::serve().

◆ debug

constexpr bool debug = false
staticprivate

Definition at line 51 of file request.hpp.

◆ error_

std::unique_ptr<io_error> error_
protected

Definition at line 56 of file request.hpp.

Referenced by request::error_occured().

◆ file_

◆ offset_

◆ on_complete_

completion_handler on_complete_
protected

Definition at line 55 of file request.hpp.

Referenced by request_with_state::cancel(), and request_with_state::completed().

◆ op_

read_or_write op_
protected

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