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::Future Class Reference

#include <Future.h>

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

Public Member Functions

 Future (size_t capacity=0)
 Future objects are used to access results from asynchronous scanners/mutators. More...
 
virtual ~Future ()
 
bool get (ResultPtr &result)
 This call blocks till there is a result available unless async ops have completed. More...
 
bool get (ResultPtr &result, uint32_t timeout_ms, bool &timed_out)
 This call blocks for the lesser of timeout / time till there is a result available. More...
 
void cancel ()
 Cancels outstanding scanners/mutators. More...
 
void register_scanner (TableScannerAsync *scanner)
 Hook for derived classes which want to keep track of scanners/mutators. More...
 
void deregister_scanner (TableScannerAsync *scanner)
 Hook for derived classes which want to keep track of scanners/mutators. More...
 
void register_mutator (TableMutatorAsync *scanner)
 Hook for derived classes which want to keep track of scanners/mutators. More...
 
void deregister_mutator (TableMutatorAsync *scanner)
 Hook for derived classes which want to keep track of scanners/mutators. More...
 
bool is_full ()
 Checks whether the Future result queue is full. More...
 
bool is_empty ()
 Checks whether the Future result queue is empty. More...
 
bool is_cancelled ()
 Checks whether the Future object has been cancelled. More...
 
bool has_outstanding ()
 Checks whether there are any outstanding operations. More...
 
- Public Member Functions inherited from Hypertable::ResultCallback
 ResultCallback ()
 
virtual ~ResultCallback ()
 
virtual void completed ()
 Callback method for completion, default one does nothing. More...
 
void wait_for_completion ()
 Blocks till outstanding == 0. More...
 
void increment_outstanding ()
 
void decrement_outstanding ()
 
bool is_done ()
 
- Public Member Functions inherited from Hypertable::ClientObject
virtual ~ClientObject ()
 Destructor. More...
 

Private Types

typedef list< ResultPtrResultQueue
 
typedef map< uint64_t,
TableScannerAsync * > 
ScannerMap
 
typedef map< uint64_t,
TableMutatorAsync * > 
MutatorMap
 

Private Member Functions

void scan_ok (TableScannerAsync *scanner, ScanCellsPtr &cells)
 Callback method for successful scan. More...
 
void scan_error (TableScannerAsync *scanner, int error, const std::string &error_msg, bool eos)
 Callback method for scan errors. More...
 
void update_ok (TableMutatorAsync *mutator)
 Callback method for successful update. More...
 
void update_error (TableMutatorAsync *mutator, int error, FailedMutations &failures)
 Callback method for update errors. More...
 
size_t memory_used ()
 
bool has_remaining_capacity ()
 
bool _is_empty ()
 
bool _is_cancelled () const
 
bool _is_done ()
 
void enqueue (ResultPtr &result)
 

Private Attributes

ResultQueue m_queue
 
size_t m_capacity {}
 
size_t m_memory_used {}
 
bool m_cancelled {}
 
ScannerMap m_scanner_map
 
MutatorMap m_mutator_map
 

Friends

class TableScannerAsync
 
class TableMutator
 

Additional Inherited Members

- Protected Attributes inherited from Hypertable::ResultCallback
int m_outstanding {}
 
std::mutex m_outstanding_mutex
 
std::condition_variable m_outstanding_cond
 

Detailed Description

Definition at line 34 of file Future.h.

Member Typedef Documentation

typedef map<uint64_t, TableMutatorAsync *> Hypertable::Future::MutatorMap
private

Definition at line 148 of file Future.h.

Definition at line 112 of file Future.h.

typedef map<uint64_t, TableScannerAsync *> Hypertable::Future::ScannerMap
private

Definition at line 147 of file Future.h.

Constructor & Destructor Documentation

Hypertable::Future::Future ( size_t  capacity = 0)
inline

Future objects are used to access results from asynchronous scanners/mutators.

Parameters
capacitybyte capacity of future queue. Results will be blocked from being enqueued if the amount of memory used by the existing enqueued results exceeds this amount. Defaults to zero, making the queue capacity unbounded.

Definition at line 43 of file Future.h.

virtual Hypertable::Future::~Future ( )
inlinevirtual

Definition at line 45 of file Future.h.

Member Function Documentation

bool Hypertable::Future::_is_cancelled ( ) const
inlineprivate

Definition at line 133 of file Future.h.

bool Hypertable::Future::_is_done ( )
inlineprivate

Definition at line 137 of file Future.h.

bool Hypertable::Future::_is_empty ( )
inlineprivate

Definition at line 132 of file Future.h.

void Future::cancel ( )

Cancels outstanding scanners/mutators.

Callers responsibility to make sure that this method gets called before async scanner/mutator destruction when the application abruptly stops processing async results before all operations are complete

Definition at line 166 of file Future.cc.

void Future::deregister_mutator ( TableMutatorAsync mutator)
virtual

Hook for derived classes which want to keep track of scanners/mutators.

Reimplemented from Hypertable::ResultCallback.

Definition at line 197 of file Future.cc.

void Future::deregister_scanner ( TableScannerAsync scanner)
virtual

Hook for derived classes which want to keep track of scanners/mutators.

Reimplemented from Hypertable::ResultCallback.

Definition at line 216 of file Future.cc.

void Future::enqueue ( ResultPtr result)
private

Definition at line 136 of file Future.cc.

bool Future::get ( ResultPtr result)

This call blocks till there is a result available unless async ops have completed.

Parameters
resultwill contain a reference to the result object
Returns
true if asynchronous operations have completed

Definition at line 35 of file Future.cc.

bool Future::get ( ResultPtr result,
uint32_t  timeout_ms,
bool &  timed_out 
)

This call blocks for the lesser of timeout / time till there is a result available.

Parameters
resultwill contain a reference to the result object
timeout_msmax milliseconds to block for
timed_outset to true if the call times out
Returns
false if asynchronous operations have completed

Definition at line 76 of file Future.cc.

bool Hypertable::Future::has_outstanding ( )
inline

Checks whether there are any outstanding operations.

Definition at line 105 of file Future.h.

bool Hypertable::Future::has_remaining_capacity ( )
inlineprivate

Definition at line 124 of file Future.h.

bool Hypertable::Future::is_cancelled ( )
inline

Checks whether the Future object has been cancelled.

Definition at line 97 of file Future.h.

bool Hypertable::Future::is_empty ( )
inline

Checks whether the Future result queue is empty.

Definition at line 89 of file Future.h.

bool Hypertable::Future::is_full ( )
inline

Checks whether the Future result queue is full.

Definition at line 81 of file Future.h.

size_t Hypertable::Future::memory_used ( )
inlineprivate

Definition at line 120 of file Future.h.

void Future::register_mutator ( TableMutatorAsync mutator)
virtual

Hook for derived classes which want to keep track of scanners/mutators.

Reimplemented from Hypertable::ResultCallback.

Definition at line 185 of file Future.cc.

void Future::register_scanner ( TableScannerAsync scanner)
virtual

Hook for derived classes which want to keep track of scanners/mutators.

Reimplemented from Hypertable::ResultCallback.

Definition at line 204 of file Future.cc.

void Future::scan_error ( TableScannerAsync scanner,
int  error,
const std::string &  error_msg,
bool  eos 
)
privatevirtual

Callback method for scan errors.

Parameters
scanner
error
error_msg
eosend of scan

Implements Hypertable::ResultCallback.

Definition at line 150 of file Future.cc.

void Future::scan_ok ( TableScannerAsync scanner,
ScanCellsPtr cells 
)
privatevirtual

Callback method for successful scan.

Parameters
scanner
cellsreturned cells

Implements Hypertable::ResultCallback.

Definition at line 131 of file Future.cc.

void Future::update_error ( TableMutatorAsync mutator,
int  error,
FailedMutations failures 
)
privatevirtual

Callback method for update errors.

Parameters
mutatorMutator pointer
errorerror code
failuresvector of failed mutations

Implements Hypertable::ResultCallback.

Definition at line 161 of file Future.cc.

void Future::update_ok ( TableMutatorAsync mutator)
privatevirtual

Callback method for successful update.

Parameters
mutator

Implements Hypertable::ResultCallback.

Definition at line 156 of file Future.cc.

Friends And Related Function Documentation

friend class TableMutator
friend

Definition at line 111 of file Future.h.

friend class TableScannerAsync
friend

Definition at line 110 of file Future.h.

Member Data Documentation

bool Hypertable::Future::m_cancelled {}
private

Definition at line 146 of file Future.h.

size_t Hypertable::Future::m_capacity {}
private

Definition at line 144 of file Future.h.

size_t Hypertable::Future::m_memory_used {}
private

Definition at line 145 of file Future.h.

MutatorMap Hypertable::Future::m_mutator_map
private

Definition at line 150 of file Future.h.

ResultQueue Hypertable::Future::m_queue
private

Definition at line 143 of file Future.h.

ScannerMap Hypertable::Future::m_scanner_map
private

Definition at line 149 of file Future.h.


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