-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix viewchange bug * format code * rm unused log * rm unused log * fix ut
- Loading branch information
Showing
48 changed files
with
613 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_binary( | ||
name = "pybind_kv.so", | ||
srcs = ["pybind_kv_service.cpp"], | ||
linkshared =1, | ||
linkshared = 1, | ||
linkstatic = 1, | ||
deps = [ | ||
"@//common/proto:signature_info_cc_proto", | ||
"@//interface/kv:kv_client", | ||
"@//platform/config:resdb_config_utils", | ||
"@pybind11//:pybind11", | ||
"@pybind11", | ||
], | ||
) | ||
|
||
py_library( | ||
name = "pybind_kv_so", | ||
data = [":pybind_kv.so"], | ||
imports = ["."], | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,3 @@ cc_binary( | |
"//service/utils:server_factory", | ||
], | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ cc_library( | |
"//common/crypto:signature_verifier", | ||
], | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 34 additions & 30 deletions
64
platform/consensus/ordering/common/algorithm/protocol_base.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,68 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
#include <google/protobuf/message.h> | ||
|
||
#include <functional> | ||
|
||
#include "common/crypto/signature_verifier.h" | ||
|
||
namespace resdb { | ||
namespace common { | ||
|
||
class ProtocolBase { | ||
public: | ||
typedef std::function<int(int, const google::protobuf::Message& msg, int)> SingleCallFuncType; | ||
typedef std::function<int(int, const google::protobuf::Message& msg)> BroadcastCallFuncType; | ||
typedef std::function<int(const google::protobuf::Message& msg)> CommitFuncType; | ||
typedef std::function<int(int, const google::protobuf::Message& msg, int)> | ||
SingleCallFuncType; | ||
typedef std::function<int(int, const google::protobuf::Message& msg)> | ||
BroadcastCallFuncType; | ||
typedef std::function<int(const google::protobuf::Message& msg)> | ||
CommitFuncType; | ||
|
||
ProtocolBase( | ||
int id, | ||
int f, | ||
int total_num, | ||
SingleCallFuncType single_call, | ||
BroadcastCallFuncType broadcast_call, | ||
CommitFuncType commit | ||
); | ||
|
||
ProtocolBase( int id, int f, int total_num); | ||
ProtocolBase(int id, int f, int total_num, SingleCallFuncType single_call, | ||
BroadcastCallFuncType broadcast_call, CommitFuncType commit); | ||
|
||
ProtocolBase(int id, int f, int total_num); | ||
|
||
virtual ~ProtocolBase(); | ||
|
||
void Stop(); | ||
|
||
inline | ||
void SetSingleCallFunc(SingleCallFuncType single_call) { single_call_ = single_call; } | ||
|
||
inline | ||
void SetBroadcastCallFunc(BroadcastCallFuncType broadcast_call) { broadcast_call_ = broadcast_call; } | ||
inline void SetSingleCallFunc(SingleCallFuncType single_call) { | ||
single_call_ = single_call; | ||
} | ||
|
||
inline void SetBroadcastCallFunc(BroadcastCallFuncType broadcast_call) { | ||
broadcast_call_ = broadcast_call; | ||
} | ||
|
||
inline | ||
void SetCommitFunc(CommitFuncType commit_func) { commit_ = commit_func; } | ||
inline void SetCommitFunc(CommitFuncType commit_func) { | ||
commit_ = commit_func; | ||
} | ||
|
||
inline | ||
void SetSignatureVerifier(SignatureVerifier* verifier) { verifier_ = verifier;} | ||
inline void SetSignatureVerifier(SignatureVerifier* verifier) { | ||
verifier_ = verifier; | ||
} | ||
|
||
protected: | ||
int SendMessage(int msg_type, const google::protobuf::Message& msg, int node_id); | ||
int Broadcast(int msg_type, const google::protobuf::Message& msg); | ||
int Commit(const google::protobuf::Message& msg); | ||
protected: | ||
int SendMessage(int msg_type, const google::protobuf::Message& msg, | ||
int node_id); | ||
int Broadcast(int msg_type, const google::protobuf::Message& msg); | ||
int Commit(const google::protobuf::Message& msg); | ||
|
||
bool IsStop(); | ||
bool IsStop(); | ||
|
||
protected: | ||
int id_; | ||
int f_; | ||
int total_num_; | ||
std::function<int(int, const google::protobuf::Message& msg, int)> single_call_; | ||
std::function<int(int, const google::protobuf::Message& msg, int)> | ||
single_call_; | ||
std::function<int(int, const google::protobuf::Message& msg)> broadcast_call_; | ||
std::function<int(const google::protobuf::Message& msg)> commit_; | ||
std::atomic<bool> stop_; | ||
|
||
SignatureVerifier* verifier_; | ||
}; | ||
|
||
} // namespace protocol | ||
} // namespace common | ||
} // namespace resdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ cc_library( | |
], | ||
) | ||
|
||
|
||
cc_library( | ||
name = "response_manager", | ||
srcs = ["response_manager.cpp"], | ||
|
Oops, something went wrong.