/proc/self/cwd/source/common/upstream/locality_endpoint.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include "envoy/config/core/v3/base.pb.h" |
4 | | #include "envoy/config/endpoint/v3/endpoint_components.pb.h" |
5 | | |
6 | | #include "source/common/protobuf/utility.h" |
7 | | |
8 | | namespace Envoy { |
9 | | namespace Upstream { |
10 | | |
11 | | using LocalityEndpointTuple = std::tuple<const envoy::config::core::v3::Locality&, |
12 | | const envoy::config::endpoint::v3::LbEndpoint&>; |
13 | | struct LocalityEndpointHash { |
14 | 0 | size_t operator()(const LocalityEndpointTuple& values) const { |
15 | 0 | const auto locality_hash = MessageUtil::hash(std::get<0>(values)); |
16 | 0 | const auto endpoint_hash = MessageUtil::hash(std::get<1>(values)); |
17 | 0 | return locality_hash ^ endpoint_hash; |
18 | 0 | } |
19 | | }; |
20 | | |
21 | | struct LocalityEndpointEqualTo { |
22 | 0 | bool operator()(const LocalityEndpointTuple& lhs, const LocalityEndpointTuple& rhs) const { |
23 | 0 | return Protobuf::util::MessageDifferencer::Equals(std::get<0>(lhs), std::get<0>(rhs)) && |
24 | 0 | Protobuf::util::MessageDifferencer::Equals(std::get<1>(lhs), std::get<1>(rhs)); |
25 | 0 | } |
26 | | }; |
27 | | |
28 | | } // namespace Upstream |
29 | | } // namespace Envoy |