Handles incoming Master requests. More...
#include <ConnectionHandler.h>
Public Member Functions | |
ConnectionHandler (ContextPtr &context) | |
Constructor. More... | |
void | start_timer () |
virtual void | handle (EventPtr &event) |
Responds to Master request events. More... | |
Public Member Functions inherited from Hypertable::DispatchHandler | |
virtual | ~DispatchHandler () |
Destructor. More... | |
Private Member Functions | |
int32_t | send_id_response (EventPtr &event, OperationPtr &operation) |
Sends operation ID back to client. More... | |
int32_t | send_error_response (EventPtr &event, int32_t error, const String &msg) |
Sends error response message back to client. More... | |
int32_t | send_ok_response (EventPtr &event, bool silent=false) |
Sends OK response message back to client. More... | |
void | maybe_dump_op_statistics () |
Maybe dumps OperationProcessor statistics. More... | |
Private Attributes | |
ContextPtr | m_context |
Pointer to Master context. More... | |
Handles incoming Master requests.
An object of this class is installed as the dispatch handler for the listen socket on which the Master receives client connections and requests. To handle transparent master failover while requests are being carried out, most requests happen in two phases:
After the operation has been created and persisted to the MML and the ID has been sent back to the client, the Master can fail and when the new Master comes up, it will complete the operation and send the results back to the client. This class also installs an interval timer and installs itself as the handler. When handling TIMER events, it checks to see if any of the following actions are necessary, and if so, it will create operations to carry them out.
Definition at line 65 of file ConnectionHandler.h.
|
inline |
Constructor.
This initializes the connection handler and installs the interval timer.
context | Master context object |
Definition at line 72 of file ConnectionHandler.h.
|
virtual |
Responds to Master request events.
event | AsyncComm event corresponding to Master request |
Implements Hypertable::DispatchHandler.
Definition at line 84 of file ConnectionHandler.cc.
|
private |
Maybe dumps OperationProcessor statistics.
This method check for the existance of the file $HT_INSTALL_DIR/run/debug-op
and if it exists, it will remove it and then call OperationProcessor::state_description() and will write the state description message to the file $HT_INSTALL_DIR/run/op.output
.
Definition at line 325 of file ConnectionHandler.cc.
|
private |
Sends error response message back to client.
This method sends an error respons message back to the client formatted as 32-bit error code by vstring error message.
Definition at line 312 of file ConnectionHandler.cc.
|
private |
Sends operation ID back to client.
event | AsyncComm event corresponding to Master request |
operation | Operation whose ID is to be sent back |
Definition at line 286 of file ConnectionHandler.cc.
|
private |
Sends OK response message back to client.
event | AsyncComm event corresponding to Master request |
silent | Don't log if errors encountered |
Definition at line 300 of file ConnectionHandler.cc.
void ConnectionHandler::start_timer | ( | ) |
Definition at line 78 of file ConnectionHandler.cc.
|
private |
Pointer to Master context.
Definition at line 118 of file ConnectionHandler.h.