0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Hypertable::TableScannerAsync Class Reference

Asynchronous table scanner. More...

#include <TableScannerAsync.h>

Inheritance diagram for Hypertable::TableScannerAsync:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::TableScannerAsync:
Collaboration graph
[legend]

Public Member Functions

 TableScannerAsync (Comm *comm, ApplicationQueueInterfacePtr &app_queue, Table *table, RangeLocatorPtr &range_locator, const ScanSpec &scan_spec, uint32_t timeout_ms, ResultCallback *cb, int flags=0)
 Constructs a TableScannerAsync object. More...
 
virtual ~TableScannerAsync ()
 
void cancel ()
 Cancels the scanner. More...
 
bool is_cancelled ()
 
bool is_complete ()
 
void handle_result (int scanner_id, EventPtr &event, bool is_create)
 Deal with results of a scanner. More...
 
void handle_error (int scanner_id, int error, const std::string &error_msg, bool is_create)
 Deal with errors. More...
 
void handle_timeout (int scanner_id, const std::string &error_msg, bool is_create)
 Deal with timeouts. More...
 
int64_t bytes_scanned ()
 Returns number of bytes scanned. More...
 
std::string get_table_name () const
 Returns the name of the table as it was when the scanner was created. More...
 
Tableget_table ()
 Returns a pointer to the table. More...
 
void get_profile_data (ProfileDataScanner &profile_data)
 Gets profile data. More...
 
- Public Member Functions inherited from Hypertable::ClientObject
virtual ~ClientObject ()
 Destructor. More...
 

Private Types

typedef std::set< const char
*, LtCstr
CstrRowSet
 

Private Member Functions

void init (Comm *comm, ApplicationQueueInterfacePtr &app_queue, Table *table, RangeLocatorPtr &range_locator, const ScanSpec &scan_spec, uint32_t timeout_ms, ResultCallback *cb)
 
void maybe_callback_ok (int scanner_id, bool next, bool do_callback, ScanCellsPtr &cells)
 
void maybe_callback_error (int scanner_id, bool next)
 
void wait_for_completion ()
 
void move_to_next_interval_scanner (int current_scanner)
 
bool use_index (Table *table, const ScanSpec &primary_spec, ScanSpecBuilder &index_spec, std::vector< CellPredicate > &cell_predicates, bool *use_qualifier, bool *row_intervals_applied)
 
void transform_primary_scan_spec (ScanSpecBuilder &primary_spec)
 
void add_index_row (ScanSpecBuilder &ssb, const char *row)
 

Private Attributes

std::vector
< IntervalScannerAsyncPtr
m_interval_scanners
 
uint32_t m_timeout_ms
 
int64_t m_bytes_scanned
 
CstrRowSet m_rowset
 
ResultCallbackm_cb
 
ProfileDataScanner m_profile_data
 
int m_current_scanner
 
std::mutex m_mutex
 
std::mutex m_cancel_mutex
 
std::condition_variable m_cond
 
int m_outstanding
 
int m_error
 
std::string m_error_msg
 
Tablem_table
 
bool m_cancelled
 
bool m_use_index
 

Friends

class IndexScannerCallback
 

Detailed Description

Asynchronous table scanner.

Definition at line 50 of file TableScannerAsync.h.

Member Typedef Documentation

typedef std::set<const char *, LtCstr> Hypertable::TableScannerAsync::CstrRowSet
private

Definition at line 161 of file TableScannerAsync.h.

Constructor & Destructor Documentation

TableScannerAsync::TableScannerAsync ( Comm comm,
ApplicationQueueInterfacePtr app_queue,
Table table,
RangeLocatorPtr range_locator,
const ScanSpec scan_spec,
uint32_t  timeout_ms,
ResultCallback cb,
int  flags = 0 
)

Constructs a TableScannerAsync object.

Parameters
commpointer to the Comm layer
app_queuepointer to ApplicationQueueInterface
tablepointer to the table object
range_locatorsmart pointer to range locator
scan_specreference to scan specification object
timeout_msmaximum time in milliseconds to allow scanner methods to execute before throwing an exception
cbcallback to be notified when results arrive
flagsScanner flags

Definition at line 42 of file TableScannerAsync.cc.

TableScannerAsync::~TableScannerAsync ( )
virtual

Definition at line 507 of file TableScannerAsync.cc.

Member Function Documentation

void TableScannerAsync::add_index_row ( ScanSpecBuilder ssb,
const char *  row 
)
private

Definition at line 380 of file TableScannerAsync.cc.

int64_t Hypertable::TableScannerAsync::bytes_scanned ( )
inline

Returns number of bytes scanned.

Returns
byte count

Definition at line 120 of file TableScannerAsync.h.

void TableScannerAsync::cancel ( )

Cancels the scanner.

Definition at line 522 of file TableScannerAsync.cc.

void Hypertable::TableScannerAsync::get_profile_data ( ProfileDataScanner profile_data)
inline

Gets profile data.

Parameters
profile_dataReference to profile data object populated by this method

Definition at line 135 of file TableScannerAsync.h.

Table* Hypertable::TableScannerAsync::get_table ( )
inline

Returns a pointer to the table.

Definition at line 130 of file TableScannerAsync.h.

String TableScannerAsync::get_table_name ( ) const

Returns the name of the table as it was when the scanner was created.

Definition at line 733 of file TableScannerAsync.cc.

void TableScannerAsync::handle_error ( int  scanner_id,
int  error,
const std::string &  error_msg,
bool  is_create 
)

Deal with errors.

Parameters
scanner_idid of the scanner which triggered the error
errorerror code
error_msgerror message
is_createtrue if this is event is for a create_scanner request

Definition at line 532 of file TableScannerAsync.cc.

void TableScannerAsync::handle_result ( int  scanner_id,
EventPtr event,
bool  is_create 
)

Deal with results of a scanner.

Parameters
scanner_idid of the scanner which triggered the error
eventevent with results
is_createtrue if this is event is for a create_scanner request

Definition at line 625 of file TableScannerAsync.cc.

void TableScannerAsync::handle_timeout ( int  scanner_id,
const std::string &  error_msg,
bool  is_create 
)

Deal with timeouts.

Parameters
scanner_idid of the scanner which triggered the error
error_msgerror message
is_createtrue if this is event is for a create_scanner request

Definition at line 604 of file TableScannerAsync.cc.

void TableScannerAsync::init ( Comm comm,
ApplicationQueueInterfacePtr app_queue,
Table table,
RangeLocatorPtr range_locator,
const ScanSpec scan_spec,
uint32_t  timeout_ms,
ResultCallback cb 
)
private

Definition at line 409 of file TableScannerAsync.cc.

bool TableScannerAsync::is_cancelled ( )

Definition at line 527 of file TableScannerAsync.cc.

bool Hypertable::TableScannerAsync::is_complete ( )
inline

Definition at line 83 of file TableScannerAsync.h.

void TableScannerAsync::maybe_callback_error ( int  scanner_id,
bool  next 
)
private

Definition at line 675 of file TableScannerAsync.cc.

void TableScannerAsync::maybe_callback_ok ( int  scanner_id,
bool  next,
bool  do_callback,
ScanCellsPtr cells 
)
private

Definition at line 699 of file TableScannerAsync.cc.

void TableScannerAsync::move_to_next_interval_scanner ( int  current_scanner)
private

Definition at line 737 of file TableScannerAsync.cc.

void TableScannerAsync::transform_primary_scan_spec ( ScanSpecBuilder primary_spec)
private

Definition at line 336 of file TableScannerAsync.cc.

bool TableScannerAsync::use_index ( Table table,
const ScanSpec primary_spec,
ScanSpecBuilder index_spec,
std::vector< CellPredicate > &  cell_predicates,
bool *  use_qualifier,
bool *  row_intervals_applied 
)
private

Definition at line 97 of file TableScannerAsync.cc.

void TableScannerAsync::wait_for_completion ( )
private

Definition at line 728 of file TableScannerAsync.cc.

Friends And Related Function Documentation

friend class IndexScannerCallback
friend

Definition at line 141 of file TableScannerAsync.h.

Member Data Documentation

int64_t Hypertable::TableScannerAsync::m_bytes_scanned
private

Definition at line 160 of file TableScannerAsync.h.

std::mutex Hypertable::TableScannerAsync::m_cancel_mutex
private

Definition at line 167 of file TableScannerAsync.h.

bool Hypertable::TableScannerAsync::m_cancelled
private

Definition at line 173 of file TableScannerAsync.h.

ResultCallback* Hypertable::TableScannerAsync::m_cb
private

Definition at line 163 of file TableScannerAsync.h.

std::condition_variable Hypertable::TableScannerAsync::m_cond
private

Definition at line 168 of file TableScannerAsync.h.

int Hypertable::TableScannerAsync::m_current_scanner
private

Definition at line 165 of file TableScannerAsync.h.

int Hypertable::TableScannerAsync::m_error
private

Definition at line 170 of file TableScannerAsync.h.

std::string Hypertable::TableScannerAsync::m_error_msg
private

Definition at line 171 of file TableScannerAsync.h.

std::vector<IntervalScannerAsyncPtr> Hypertable::TableScannerAsync::m_interval_scanners
private

Definition at line 158 of file TableScannerAsync.h.

std::mutex Hypertable::TableScannerAsync::m_mutex
private

Definition at line 166 of file TableScannerAsync.h.

int Hypertable::TableScannerAsync::m_outstanding
private

Definition at line 169 of file TableScannerAsync.h.

ProfileDataScanner Hypertable::TableScannerAsync::m_profile_data
private

Definition at line 164 of file TableScannerAsync.h.

CstrRowSet Hypertable::TableScannerAsync::m_rowset
private

Definition at line 162 of file TableScannerAsync.h.

Table* Hypertable::TableScannerAsync::m_table
private

Definition at line 172 of file TableScannerAsync.h.

uint32_t Hypertable::TableScannerAsync::m_timeout_ms
private

Definition at line 159 of file TableScannerAsync.h.

bool Hypertable::TableScannerAsync::m_use_index
private

Definition at line 174 of file TableScannerAsync.h.


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