-
Notifications
You must be signed in to change notification settings - Fork 2
/
kvraft_service_impl.h
executable file
·42 lines (30 loc) · 1.17 KB
/
kvraft_service_impl.h
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
/* kvraft_service_impl.h
Generated by phxrpc_pb2service from kvraft.proto
*/
#pragma once
#include "phxrpc/network.h"
//#include "kvserver.h"
#include "kvraft.pb.h"
#include "phxrpc_kvraft_service.h"
class KVRaftServerConfig;
namespace raftkv{
class KvServer;
}
typedef struct tagServiceArgs {
KVRaftServerConfig *config;
raftkv::KvServer* server;
// you can add other arguments here and initiate in main().
} ServiceArgs_t;
class KVRaftServiceImpl : public KVRaftService {
public:
KVRaftServiceImpl(ServiceArgs_t &app_args,
phxrpc::UThreadEpollScheduler *worker_uthread_scheduler);
virtual ~KVRaftServiceImpl() override;
virtual int PHXEcho(const google::protobuf::StringValue &req, google::protobuf::StringValue *resp) override;
virtual int RequestVote(const kvraft::RequestVoteArgs &req, kvraft::RequestVoteReply *resp) override;
virtual int AppendEntries(const kvraft::AppendEntriesArgs &req, kvraft::AppendEntriesReply *resp) override;
virtual int Command(const kvraft::KVArgs &req, kvraft::KVReply *resp) override;
private:
ServiceArgs_t &args_;
phxrpc::UThreadEpollScheduler *worker_uthread_scheduler_{nullptr};
};