Merge branch 'T0879-MG-transport-prototype' of github.com:memgraph/memgraph into T0941-MG-implement-basic-raft-version

This commit is contained in:
Tyler Neely 2022-08-10 10:48:17 +00:00
commit f098d6b331
3 changed files with 15 additions and 15 deletions

View File

@ -37,19 +37,19 @@ struct Address {
return ret;
}
bool operator==(const Address &other) const = default;
friend bool operator==(const Address &lhs, const Address &rhs) = default;
/// unique_id is most dominant for ordering, then last_known_ip, then last_known_port
bool operator<(const Address &other) const {
if (unique_id != other.unique_id) {
return unique_id < other.unique_id;
friend bool operator<(const Address &lhs, const Address &rhs) {
if (lhs.unique_id != rhs.unique_id) {
return lhs.unique_id < rhs.unique_id;
}
if (last_known_ip != other.last_known_ip) {
return last_known_ip < other.last_known_ip;
if (lhs.last_known_ip != rhs.last_known_ip) {
return lhs.last_known_ip < rhs.last_known_ip;
}
return last_known_port < other.last_known_port;
return lhs.last_known_port < rhs.last_known_port;
}
std::string ToString() const {

View File

@ -97,7 +97,7 @@ class Shared {
return Take();
}
bool IsReady() {
bool IsReady() const {
std::unique_lock<std::mutex> lock(mu_);
return item_;
}
@ -125,7 +125,7 @@ class Shared {
cv_.notify_all();
}
bool IsAwaited() {
bool IsAwaited() const {
std::unique_lock<std::mutex> lock(mu_);
return waiting_;
}

View File

@ -43,16 +43,16 @@ struct PromiseKey {
Address replier_address;
public:
bool operator<(const PromiseKey &other) const {
if (requester_address != other.requester_address) {
return requester_address < other.requester_address;
friend bool operator<(const PromiseKey &lhs, const PromiseKey &rhs) {
if (lhs.requester_address != rhs.requester_address) {
return lhs.requester_address < rhs.requester_address;
}
if (request_id != other.request_id) {
return request_id < other.request_id;
if (lhs.request_id != rhs.request_id) {
return lhs.request_id < rhs.request_id;
}
return replier_address < other.replier_address;
return lhs.replier_address < rhs.replier_address;
}
};