Skip to content

Commit 2e0e68f

Browse files
committed
adapt latest lotus
1 parent e413491 commit 2e0e68f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

example/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]){
9191

9292
while(true){
9393
if(app.IsLeader()){
94-
string buf = input();
94+
std::string buf = input();
9595
app.Set(std::string(buf));
9696
sleep(1);
9797
app.Get();

raft/raft_server.h

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
55
#include <mutex>
66
#include <functional>
77
#include <stdio.h>
8-
#include "lotus/service.h"
9-
#include "lotus/engine.h"
10-
#include "lotus/protocol/rpc.h"
8+
#include "lotus/lotus.h"
119
#include "proto/raftmsg.pb.h"
1210
#include "transport.h"
1311
#include "raft.h"
1412
#include "raft_sm.h"
1513
#include "options.h"
1614

1715

18-
class RaftServer : public service_t<rpc_request_t, rpc_response_t> {
16+
class RaftServer : public rpc_service_t {
1917
public:
2018
RaftServer(engine_t *eng):
21-
service_t<rpc_request_t, rpc_response_t>(std::bind(&RaftServer::process, this, std::placeholders::_1)),
19+
rpc_service_t(std::bind(&RaftServer::Process, this, std::placeholders::_1)),
2220
eng_(eng){
2321
trans_ = new Transport(eng_, this);
2422
}
@@ -124,7 +122,7 @@ class RaftServer : public service_t<rpc_request_t, rpc_response_t> {
124122
}
125123

126124
public:
127-
int process(session_t<rpc_request_t, rpc_response_t> *session) {
125+
int Process(rpc_session_t *session) {
128126
rpc_response_t response;
129127
rpc_response_t *rsp = &response;
130128
fprintf(stderr, "rpc server process.\n");
@@ -180,7 +178,7 @@ class RaftServer : public service_t<rpc_request_t, rpc_response_t> {
180178
engine_t *eng_;
181179

182180
std::map<uint64_t, Raft*> rafts_; //guard by mutex_
183-
std::map<uint64_t, vector<raft::Peer*>> peers_; //guard by mutex_
181+
std::map<uint64_t, std::vector<raft::Peer*>> peers_; //guard by mutex_
184182
std::mutex mutex_;
185183

186184
Transport *trans_;

raft/transport.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int Transport::Send(const address_t *addr, const std::shared_ptr<raft::RaftMessa
2525
}
2626
}
2727

28-
string tmp;
28+
std::string tmp;
2929
msg->SerializeToString(&tmp);
3030
fprintf(stderr, "SEND:%X len=%d\n", tmp.c_str(), tmp.size());
3131

0 commit comments

Comments
 (0)