FlashGraph-ng
A new frontier in large-scale graph analysis and data mining
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
safs::io_interface Class Referenceabstract

#include <io_interface.h>

Inheritance diagram for safs::io_interface:
safs::direct_comp_io

Public Member Functions

thread * get_thread () const
 
int get_node_id () const
 
int get_io_id () const
 
int get_remaining_io_slots () const
 
virtual int get_file_id () const =0
 
virtual void cleanup ()
 
virtual bool support_aio ()
 
virtual void access (io_request *requests, int num, io_status *status=NULL)
 
virtual void flush_requests ()
 
virtual int wait4complete (int num)
 
virtual int num_pending_ios () const
 
virtual int get_max_num_pending_ios () const
 
virtual void set_max_num_pending_ios (int max)
 
virtual bool set_callback (callback::ptr cb)
 
virtual callbackget_callback ()
 
virtual io_status access (char *buf, off_t off, ssize_t size, int access_method)
 

Detailed Description

This class defines the interface of accessing a SAFS file. An I/O instance is not thread-safe, so we need to create an instance for each thread. In the case of asynchronous I/O, the user-defined callback function is guaranteed to be invoked in the same threads as the I/O request was issued.

Member Function Documentation

virtual void safs::io_interface::access ( io_request requests,
int  num,
io_status status = NULL 
)
inlinevirtual

The asynchronous IO should implement some of the following methods. The main interface of sending asynchronous I/O requests.

Parameters
requestsan array of I/O requests to be issued.
numthe number of I/O requests to be issued.
statusan array of I/O status, one for each I/O request.

Reimplemented in safs::direct_comp_io.

virtual io_status safs::io_interface::access ( char *  buf,
off_t  off,
ssize_t  size,
int  access_method 
)
inlinevirtual

The synchronous IO interface.

Parameters
bufthe data buffer.
offthe location in the file where data should be read from or written to.
sizethe size of data.
access_methodwhether to read or write.
Returns
I/O status for the request.
virtual void safs::io_interface::cleanup ( )
inlinevirtual

This method is called when the I/O instance is destroyed.

Reimplemented in safs::direct_comp_io.

virtual void safs::io_interface::flush_requests ( )
inlinevirtual

This method flushes I/O requests. When requests are passed to the access method, an IO layer may buffer the requests. This method guarantees that all requests are flushed to the underlying devices.

Reimplemented in safs::direct_comp_io.

virtual callback& safs::io_interface::get_callback ( )
inlinevirtual

This method gets the user-defined callback.

Returns
the user-defined callback.
virtual int safs::io_interface::get_file_id ( ) const
pure virtual

This method returns the ID of the file being accessed by the IO instance.

Returns
the file ID.

Implemented in safs::direct_comp_io.

int safs::io_interface::get_io_id ( ) const
inline

This method gets the ID of the I/O instance.

Returns
the ID of the I/O instance.
virtual int safs::io_interface::get_max_num_pending_ios ( ) const
inlinevirtual

This method gets the maximal number of I/O requests allowed to be pending in the I/O instance.

Returns
the maximal number of pending I/O requests.
int safs::io_interface::get_node_id ( ) const
inline

This method gets the NUMA node that the I/O instance is used.

Returns
the NUMA node id.
int safs::io_interface::get_remaining_io_slots ( ) const
inline

This method gets the number of requests still allowed to be sent to the IO instance.

Returns
the number of requests.
thread* safs::io_interface::get_thread ( ) const
inline

This method get the thread that the I/O instance is associated with.

Returns
the thread.
virtual int safs::io_interface::num_pending_ios ( ) const
inlinevirtual

This method gets the number of I/O requests pending in the I/O instance.

Returns
the number of pending I/O requests.

Reimplemented in safs::direct_comp_io.

virtual bool safs::io_interface::set_callback ( callback::ptr  cb)
inlinevirtual

This method sets the callback if the class supports the asynchronous I/O.

Parameters
cbthe user-defined callback.
Returns
false if the class doesn't support async I/O.
virtual void safs::io_interface::set_max_num_pending_ios ( int  max)
inlinevirtual

This method sets the maximal number of I/O requests allowed to be pending in the I/O instance.

Parameters
themaximal number of I/O requests.
virtual bool safs::io_interface::support_aio ( )
inlinevirtual

This method indicates whether it supports asynchronous IO interface.

Returns
boolean.

Reimplemented in safs::direct_comp_io.

virtual int safs::io_interface::wait4complete ( int  num)
inlinevirtual

This method waits for at least the specified number of requests issued by the access method to complete.

Parameters
thenumber of requests that need to be completed.

Reimplemented in safs::direct_comp_io.


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