Go to the documentation of this file.
31 #include "absl/status/status.h"
32 #include "absl/status/statusor.h"
33 #include "absl/strings/str_cat.h"
34 #include "absl/strings/str_format.h"
35 #include "absl/strings/str_join.h"
47 "server_address_weight";
55 std::map<
const char*, std::unique_ptr<AttributeInterface>> attributes)
60 std::map<
const char*, std::unique_ptr<AttributeInterface>> attributes)
89 attributes_(
std::move(other.attributes_)) {
90 other.args_ =
nullptr;
97 other.args_ =
nullptr;
98 attributes_ =
std::move(other.attributes_);
104 int CompareAttributes(
106 std::unique_ptr<ServerAddress::AttributeInterface>>&
109 std::unique_ptr<ServerAddress::AttributeInterface>>&
111 auto it2 = attributes2.begin();
112 for (
auto it1 = attributes1.begin(); it1 != attributes1.end(); ++it1) {
114 if (it2 == attributes2.end())
return -1;
116 int retval = strcmp(it1->first, it2->first);
117 if (retval != 0)
return retval;
119 retval = it1->second->Cmp(it2->second.get());
120 if (retval != 0)
return retval;
124 if (it2 != attributes2.end())
return 1;
135 if (retval != 0)
return retval;
137 if (retval != 0)
return retval;
142 const char*
key)
const {
145 return it->second.get();
151 const char*
key, std::unique_ptr<AttributeInterface>
value)
const {
153 if (
value ==
nullptr) {
163 std::vector<std::string> parts = {
164 addr_str.ok() ? addr_str.value() : addr_str.status().ToString(),
166 if (
args_ !=
nullptr) {
170 std::vector<std::string>
attrs;
ServerAddress & operator=(const ServerAddress &other)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
grpc_channel_args * args_
absl::StatusOr< std::string > grpc_sockaddr_to_string(const grpc_resolved_address *resolved_addr, bool normalize)
const grpc_resolved_address & address() const
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
int grpc_channel_args_compare(const grpc_channel_args *a, const grpc_channel_args *b)
void grpc_channel_args_destroy(grpc_channel_args *a)
ServerAddress WithAttribute(const char *key, std::unique_ptr< AttributeInterface > value) const
grpc_channel_args * grpc_channel_args_copy(const grpc_channel_args *src)
ServerAddress(const grpc_resolved_address &address, grpc_channel_args *args, std::map< const char *, std::unique_ptr< AttributeInterface >> attributes={})
static const char * kServerAddressWeightAttributeKey
int Cmp(const ServerAddress &other) const
std::string ToString() const
std::map< const char *, std::unique_ptr< AttributeInterface > > attributes_
std::string ToString() const override
grpc_channel_args * args_
const AttributeInterface * GetAttribute(const char *key) const
grpc_resolved_address address_
char addr[GRPC_MAX_SOCKADDR_SIZE]
std::string grpc_channel_args_string(const grpc_channel_args *args)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:11