-
Notifications
You must be signed in to change notification settings - Fork 2
/
kvraft_service_impl.cpp
executable file
·46 lines (31 loc) · 1.18 KB
/
kvraft_service_impl.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
/* kvraft_service_impl.cpp
Generated by phxrpc_pb2service from kvraft.proto
*/
#include "kvraft_service_impl.h"
#include "phxrpc/file.h"
#include "kvraft_server_config.h"
#include "kvraft.pb.h"
#include "kvserver.h"
using namespace std;
KVRaftServiceImpl::KVRaftServiceImpl(ServiceArgs_t &app_args,
phxrpc::UThreadEpollScheduler *const worker_uthread_scheduler)
: args_(app_args), worker_uthread_scheduler_(worker_uthread_scheduler) {
}
KVRaftServiceImpl::~KVRaftServiceImpl() {
}
int KVRaftServiceImpl::PHXEcho(const google::protobuf::StringValue &req, google::protobuf::StringValue *resp) {
resp->set_value(req.value());
return 0;
}
int KVRaftServiceImpl::RequestVote(const kvraft::RequestVoteArgs &req, kvraft::RequestVoteReply *resp) {
args_.server->RequestVote(req,resp);
return -1;
}
int KVRaftServiceImpl::AppendEntries(const kvraft::AppendEntriesArgs &req, kvraft::AppendEntriesReply *resp) {
args_.server->AppendEntries(req,resp);
return -1;
}
int KVRaftServiceImpl::Command(const kvraft::KVArgs &req, kvraft::KVReply *resp) {
args_.server->Command(req,resp,worker_uthread_scheduler_);
return -1;
}