DispatchHandler class for managing async RangeServer requests. More...
#include <DispatchHandlerOperation.h>


Classes | |
| struct | LtEventPtr |
| Strict Weak Ordering for comparing events by source address. More... | |
| class | Result |
| Holds request result information. More... | |
Public Member Functions | |
| DispatchHandlerOperation (ContextPtr &context) | |
| Constructor. More... | |
| void | start (StringSet &locations) |
| Starts asynchronous request. More... | |
| virtual void | start (const String &location)=0 |
| Method overridden in derived class for issuing requests. More... | |
| virtual void | result_callback (const EventPtr &event) |
| Post-request hook method. More... | |
| virtual void | handle (EventPtr &event) |
| Process response event. More... | |
| bool | wait_for_completion () |
| Waits for requests to complete. More... | |
| void | process_events () |
| Processes m_events set. More... | |
| void | get_results (std::set< Result > &results) |
| Returns the Result set. More... | |
Public Member Functions inherited from Hypertable::DispatchHandler | |
| virtual | ~DispatchHandler () |
| Destructor. More... | |
Protected Attributes | |
| ContextPtr | m_context |
| Master context More... | |
| RangeServer::Client | m_rsclient |
| Range server client object More... | |
Private Attributes | |
| std::mutex | m_mutex |
| Mutex for serializing concurrent access More... | |
| std::condition_variable | m_cond |
| Condition variable used to wait for completion. More... | |
| std::set< EventPtr, LtEventPtr > | m_events |
| Set of events generated by range server responses. More... | |
| int | m_outstanding {} |
| Outstanding request count that have not completed. More... | |
| int | m_error_count {} |
| Error count More... | |
| StringSet | m_locations |
| Set of servers participating in operation. More... | |
| std::set< Result > | m_results |
| Set of result objects. More... | |
DispatchHandler class for managing async RangeServer requests.
This class is a DispatchHandler class that is used for managing asynchronous requests to a set of range servers.
Definition at line 57 of file DispatchHandlerOperation.h.
| DispatchHandlerOperation::DispatchHandlerOperation | ( | ContextPtr & | context | ) |
Constructor.
| context | Master context |
Definition at line 41 of file DispatchHandlerOperation.cc.
| void DispatchHandlerOperation::get_results | ( | std::set< Result > & | results | ) |
Returns the Result set.
This method copies m_results to the results parameter.
| results | Reference to Result set to be populated. |
Definition at line 132 of file DispatchHandlerOperation.cc.
|
virtual |
Process response event.
This method inserts event int m_events set, decrements m_outstanding, and then signals m_cond if m_outstanding has dropped to zero
| event | Response event |
Implements Hypertable::DispatchHandler.
Definition at line 78 of file DispatchHandlerOperation.cc.
| void DispatchHandlerOperation::process_events | ( | ) |
Processes m_events set.
For each event in m_events, this method creates a Result object, sets the error code and error message extracted from the event payload, and adds the result object to the m_results set. This method also makes a call to result_callback() for each event.
Definition at line 94 of file DispatchHandlerOperation.cc.
|
inlinevirtual |
Post-request hook method.
This method can be overridden by derived classes to do post-processing on each request result.
| event | Response event |
Reimplemented in Hypertable::DispatchHandlerOperationSystemStatus, and Hypertable::DispatchHandlerOperationGetStatistics.
Definition at line 107 of file DispatchHandlerOperation.h.
| void DispatchHandlerOperation::start | ( | StringSet & | locations | ) |
Starts asynchronous request.
This method first initializes m_error_count to 0, m_locations to locations, and m_outstanding to locations.size(), and then kicks of a request for each location with a call to start().
| locations | Set of locations for which to issue requests |
Definition at line 46 of file DispatchHandlerOperation.cc.
|
pure virtual |
Method overridden in derived class for issuing requests.
| location | Proxy name of server to issue request. |
Implemented in Hypertable::DispatchHandlerOperationSystemStatus, Hypertable::DispatchHandlerOperationSetState, Hypertable::DispatchHandlerOperationCompact, Hypertable::DispatchHandlerOperationToggleTableMaintenance, Hypertable::DispatchHandlerOperationGetStatistics, Hypertable::DispatchHandlerOperationAlterTable, and Hypertable::DispatchHandlerOperationDropTable.
| bool DispatchHandlerOperation::wait_for_completion | ( | ) |
Waits for requests to complete.
This method waits on m_cond until m_outstanding drops to zero and then calls process_events().
Definition at line 124 of file DispatchHandlerOperation.cc.
|
private |
Condition variable used to wait for completion.
Definition at line 160 of file DispatchHandlerOperation.h.
|
protected |
Master context
Definition at line 142 of file DispatchHandlerOperation.h.
|
private |
Error count
Definition at line 169 of file DispatchHandlerOperation.h.
|
private |
Set of events generated by range server responses.
Definition at line 163 of file DispatchHandlerOperation.h.
|
private |
Set of servers participating in operation.
Definition at line 172 of file DispatchHandlerOperation.h.
|
private |
Mutex for serializing concurrent access
Definition at line 157 of file DispatchHandlerOperation.h.
|
private |
Outstanding request count that have not completed.
Definition at line 166 of file DispatchHandlerOperation.h.
|
private |
Set of result objects.
Definition at line 175 of file DispatchHandlerOperation.h.
|
protected |
Range server client object
Definition at line 145 of file DispatchHandlerOperation.h.
1.8.8