22#include <glog/logging.h>
30 config.GetClientTimeoutMs()) {
34absl::StatusOr<std::string> TransactionConstructor::GetResponseData(
35 const Response& response) {
37 std::set<int64_t> hash_counter;
39 for (
const auto& each_resp : response.resp()) {
43 if (!hash_.empty() && hash != hash_) {
44 LOG(ERROR) <<
"hash not the same";
45 return absl::InvalidArgumentError(
"hash not match");
49 resp_str = each_resp.data();
51 hash_counter.insert(each_resp.signature().node_id());
56 if (hash_counter.size() >=
60 return absl::InvalidArgumentError(
"data not enough");
64 const google::protobuf::Message& message, Request::Type type) {
71 const google::protobuf::Message& message,
72 google::protobuf::Message* response, Request::Type type) {
79 if (!response->ParseFromString(resp_str)) {
80 LOG(ERROR) <<
"parse response fail:" << resp_str.size();
virtual int RecvRawMessageData(std::string *message_str)
void SetRecvTimeout(int microseconds)
std::unique_ptr< Socket > socket_
virtual int SendRequest(const google::protobuf::Message &message, Request::Type cmd, bool need_response=false)
void SetDestReplicaInfo(const ReplicaInfo &replica)
int GetMinClientReceiveNum() const
const std::vector< ReplicaInfo > & GetReplicaInfos() const
static std::string CalculateHash(const std::string &str)
int SendRequest(const google::protobuf::Message &message, Request::Type type=Request::TYPE_CLIENT_REQUEST)
TransactionConstructor(const ResDBConfig &config)
std::unique_ptr< ResDBConfig > config_