Representing a server inside a NamingService.
| 26 | |
| 27 | // Representing a server inside a NamingService. |
| 28 | struct ServerNode { |
| 29 | typedef std::unordered_map<std::string, std::string> MetaMap; |
| 30 | |
| 31 | ServerNode() = default; |
| 32 | |
| 33 | explicit ServerNode(const butil::EndPoint& pt) : addr(pt) {} |
| 34 | |
| 35 | ServerNode(butil::ip_t ip, int port, const std::string& tag2) |
| 36 | : addr(ip, port), tag(tag2) {} |
| 37 | |
| 38 | ServerNode(const butil::EndPoint& pt, const std::string& tag2) |
| 39 | : addr(pt), tag(tag2) {} |
| 40 | |
| 41 | ServerNode(butil::ip_t ip, int port) : addr(ip, port) {} |
| 42 | |
| 43 | butil::EndPoint addr; |
| 44 | std::string tag; |
| 45 | MetaMap meta_map; |
| 46 | }; |
| 47 | |
| 48 | inline bool operator<(const ServerNode& n1, const ServerNode& n2) |
| 49 | { return n1.addr != n2.addr ? (n1.addr < n2.addr) : (n1.tag < n2.tag); } |
no outgoing calls