|
LogCabin
|
An asynchronous version of call(). More...
#include <LeaderRPC.h>
Public Types | |
| enum | Status { OK, RETRY, TIMEOUT, INVALID_REQUEST } |
| Return type for LeaderRPCBase::Call::wait(). More... | |
Public Member Functions | |
| Call () | |
| Constructor. | |
| virtual | ~Call () |
| Destructor. | |
| virtual void | start (OpCode opCode, const google::protobuf::Message &request, TimePoint timeout)=0 |
| Invoke the RPC. | |
| virtual void | cancel ()=0 |
| Cancel the RPC. | |
| virtual Status | wait (google::protobuf::Message &response, TimePoint timeout)=0 |
| Wait for the RPC to complete. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Status &server) |
| Print out a Status for debugging purposes. | |
An asynchronous version of call().
This allows multiple RPCs to be executed concurrently, or canceling an RPC that is running on a separate thread.
Definition at line 129 of file LeaderRPC.h.
Return type for LeaderRPCBase::Call::wait().
| OK |
The RPC completed scucessfully. |
| RETRY |
The RPC did not succeed, nor did it timeout. The caller should try again. TODO(ongaro): this is a bit ugly |
| TIMEOUT |
The given timeout elapsed before the RPC completed. |
| INVALID_REQUEST |
The server rejected the request, probably because it doesn't support the opcode, or maybe the request arguments were invalid. |
Definition at line 134 of file LeaderRPC.h.
| LogCabin::Client::LeaderRPCBase::Call::Call | ( | ) | [inline] |
Constructor.
Definition at line 165 of file LeaderRPC.h.
| virtual LogCabin::Client::LeaderRPCBase::Call::~Call | ( | ) | [inline, virtual] |
Destructor.
Reimplemented in LogCabin::Client::LeaderRPC::Call.
Definition at line 169 of file LeaderRPC.h.
| virtual void LogCabin::Client::LeaderRPCBase::Call::start | ( | OpCode | opCode, |
| const google::protobuf::Message & | request, | ||
| TimePoint | timeout | ||
| ) | [pure virtual] |
Invoke the RPC.
| opCode | RPC operation code. The caller must guarantee that this is a valid opCode. (If the server rejects it, this will PANIC.) |
| request | The parameters for the operation. The caller must guarantee that this is a well-formed request. (If the server rejects it, this will PANIC.) |
| timeout | After this time has elapsed, stop trying to initiate the connection to the leader and use an invalid session, which will cause the RPC to fail later. |
Implemented in LogCabin::Client::LeaderRPC::Call, LogCabin::Client::anonymous_namespace{MockClientImpl.cc}::TreeLeaderRPC::Call, and LogCabin::Client::LeaderRPCMock::Call.
| virtual void LogCabin::Client::LeaderRPCBase::Call::cancel | ( | ) | [pure virtual] |
Cancel the RPC.
This may only be called after start(), but it may be called safely from a separate thread.
Implemented in LogCabin::Client::LeaderRPC::Call, LogCabin::Client::anonymous_namespace{MockClientImpl.cc}::TreeLeaderRPC::Call, and LogCabin::Client::LeaderRPCMock::Call.
| virtual Status LogCabin::Client::LeaderRPCBase::Call::wait | ( | google::protobuf::Message & | response, |
| TimePoint | timeout | ||
| ) | [pure virtual] |
Wait for the RPC to complete.
| [out] | response | If successful, the response to the operation will be filled in here. |
| timeout | After this time has elapsed, stop waiting and return TIMEOUT. In this case, response will be left unmodified. |
Implemented in LogCabin::Client::LeaderRPC::Call, LogCabin::Client::anonymous_namespace{MockClientImpl.cc}::TreeLeaderRPC::Call, and LogCabin::Client::LeaderRPCMock::Call.
| std::ostream& operator<< | ( | std::ostream & | os, |
| const Status & | server | ||
| ) | [friend] |
Print out a Status for debugging purposes.
Definition at line 50 of file LeaderRPC.cc.
1.7.6.1