-
Notifications
You must be signed in to change notification settings - Fork 2
/
phxrpc_kvraft_stub.cpp
executable file
·56 lines (42 loc) · 1.79 KB
/
phxrpc_kvraft_stub.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* phxrpc_kvraft_stub.cpp
Generated by phxrpc_pb2client from kvraft.proto
Please DO NOT edit unless you know exactly what you are doing.
*/
#include "phxrpc_kvraft_stub.h"
#include "phxrpc/http.h"
#include "phxrpc/network.h"
#include "phxrpc/rpc.h"
KVRaftStub::KVRaftStub(phxrpc::BaseTcpStream &socket, phxrpc::ClientMonitor &client_monitor,
phxrpc::BaseMessageHandlerFactory &msg_handler_factory)
: socket_(socket), client_monitor_(client_monitor),
msg_handler_factory_(msg_handler_factory) {
}
KVRaftStub::~KVRaftStub() {
}
void KVRaftStub::set_keep_alive(const bool keep_alive) {
keep_alive_ = keep_alive;
}
int KVRaftStub::PHXEcho(const google::protobuf::StringValue &req, google::protobuf::StringValue *resp) {
phxrpc::Caller caller(socket_, client_monitor_, msg_handler_factory_);
caller.set_uri("/kvraft/PHXEcho", -1);
caller.set_keep_alive(keep_alive_);
return caller.Call(req, resp);
}
int KVRaftStub::RequestVote(const kvraft::RequestVoteArgs &req, kvraft::RequestVoteReply *resp) {
phxrpc::Caller caller(socket_, client_monitor_, msg_handler_factory_);
caller.set_uri("/kvraft/RequestVote", -1);
caller.set_keep_alive(keep_alive_);
return caller.Call(req, resp);
}
int KVRaftStub::AppendEntries(const kvraft::AppendEntriesArgs &req, kvraft::AppendEntriesReply *resp) {
phxrpc::Caller caller(socket_, client_monitor_, msg_handler_factory_);
caller.set_uri("/kvraft/AppendEntries", -1);
caller.set_keep_alive(keep_alive_);
return caller.Call(req, resp);
}
int KVRaftStub::Command(const kvraft::KVArgs &req, kvraft::KVReply *resp) {
phxrpc::Caller caller(socket_, client_monitor_, msg_handler_factory_);
caller.set_uri("/kvraft/Command", -1);
caller.set_keep_alive(keep_alive_);
return caller.Call(req, resp);
}