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::user_compute Class Referenceabstract

#include <io_request.h>

Inherited by fg::merged_vertex_compute, fg::sparse_vertex_compute, fg::vertex_compute, and safs::KV_compute< ValueType, ValueTaskType >.

Public Member Functions

 user_compute (compute_allocator *alloc)
 
compute_allocatorget_allocator () const
 
virtual int serialize (char *buf, int size) const =0
 
virtual int get_serialized_size () const =0
 
virtual void run (page_byte_array &arr)=0
 
virtual bool has_completed ()=0
 
virtual int has_requests ()=0
 
virtual request_range get_next_request ()=0
 
virtual void set_scan_dir (bool forward)
 
bool fetch_request (io_interface *io, io_request &req)
 
int fetch_requests (io_interface *io, user_comp_req_queue &reqs, int max_fetch)
 
void inc_ref ()
 
void dec_ref ()
 
int get_ref () const
 

Detailed Description

This class defines the interface of a user task assocaited with an I/O request. The user task is executed in the page cache when the I/O request is complete. It is executd as follows: upon the completion of an I/O request, run() is invoked; SAFS invokes has_requests() to check whether the user task has more I/O requests; if the user task has more requests, SAFS invokes get_next_request() to get more requests; SAFS invokes has_completed() to check whether the user task has completed; if a user task has been completed, SAFS destroys the user task.

Constructor & Destructor Documentation

safs::user_compute::user_compute ( compute_allocator alloc)
inline

The constructor.

Parameters
allocthe object allocator that allocates the user task.

Member Function Documentation

void safs::user_compute::dec_ref ( )
inline

This method decreases the reference count of this object.

bool safs::user_compute::fetch_request ( io_interface io,
io_request req 
)

This method fetches an I/O request from the user task. This is a helper method that wraps on the user-defined get_next_request.

Parameters
iothe I/O instance associated with the fetched I/O request.
reqthe fetched I/O request.
Returns
true if a user can fetch an I/O request.
int safs::user_compute::fetch_requests ( io_interface io,
user_comp_req_queue &  reqs,
int  max_fetch 
)

This method fetches multiple I/O requests from the user task. This is also a helper method that wraps on the user-defined get_next_request.

Parameters
iothe I/O instance associated with the fetched I/O request.
reqsthe array where the fetched I/O requests should be stored.
max_fetchthe maximal number of I/O requests should be fetched from the user task.
Returns
the number of I/O requests fetched from the user task.
compute_allocator* safs::user_compute::get_allocator ( ) const
inline

This method gets the object allocator that allocates the user task.

Returns
the object allocator.
virtual request_range safs::user_compute::get_next_request ( )
pure virtual

This method get the next I/O request generated by the user task. When the method is invoked, we have to call has_requests() to check that the user task has more I/O requests.

Returns
the next I/O request.
int safs::user_compute::get_ref ( ) const
inline

This method gets the reference count of this object.

Returns
the reference count.
virtual int safs::user_compute::get_serialized_size ( ) const
pure virtual

This method gets the serialized size of the user task. It's currently not used.

Returns
the serialized size of the user task.
virtual bool safs::user_compute::has_completed ( )
pure virtual

This method indicates whether the user task has been completed.

Returns
whether the user task has been completed.
virtual int safs::user_compute::has_requests ( )
pure virtual

This method indicates whether the user task has more I/O requests to be issued.

Returns
whether the user task has more I/O requests to be issued.
void safs::user_compute::inc_ref ( )
inline

This method increases the reference count of the object.

virtual void safs::user_compute::run ( page_byte_array arr)
pure virtual

This method executes the user task on the data read by the I/O request that the user task is associated with. The data read by the I/O request is stored in the page cache.

Parameters
arrthe byte array that contains the data read by the I/O request and is stored in the page cache.
virtual int safs::user_compute::serialize ( char *  buf,
int  size 
) const
pure virtual

This method serialize the user task to a buffer. It's currently not used.

Parameters
bufthe data buffer where the user task is serialized to.
sizethe buffer size.
virtual void safs::user_compute::set_scan_dir ( bool  forward)
inlinevirtual

FIXME set the direction of iterating the I/O requests generated by the user task.


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