MCPcopy Create free account
hub / github.com/apache/brpc / EndpointHost

Function EndpointHost

src/brpc/redis_cluster.cpp:108–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static std::string EndpointHost(const std::string& endpoint) {
109 std::string ep = endpoint;
110 if (!ep.empty() && ep[0] == '[') {
111 const size_t right = ep.find(']');
112 if (right != std::string::npos) {
113 return ep.substr(1, right - 1);
114 }
115 return ep;
116 }
117 const size_t p = ep.rfind(':');
118 if (p == std::string::npos) {
119 return ep;
120 }
121 return ep.substr(0, p);
122}
123
124static bool EncodeReply(const RedisReply& reply, butil::IOBuf* out) {
125 butil::IOBufAppender appender;

Callers 1

Calls 4

substrMethod · 0.80
rfindMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected