示例#1
0
static std::vector<dnet_raw_id> backend_ids(session &sess, const address &addr, uint32_t backend_id)
{
	std::vector<dnet_route_entry> routes = sess.get_routes();
	std::vector<dnet_raw_id> result;

	for (auto it = routes.begin(); it != routes.end(); ++it) {
		if (it->addr == addr && it->backend_id == backend_id)
			result.push_back(it->id);
	}

	return result;
}
示例#2
0
static std::set<std::tuple<std::string, int, uint32_t>> get_unique_hosts(session &sess)
{
	std::vector<dnet_route_entry> routes = sess.get_routes();

	std::set<std::tuple<std::string, int, uint32_t>> unique_hosts;

	for (auto it = routes.begin(); it != routes.end(); ++it) {
		dnet_route_entry &entry = *it;
		std::string addr = dnet_server_convert_dnet_addr(&entry.addr);

		unique_hosts.insert(std::make_tuple(addr, entry.group_id, entry.backend_id));
	}

	return unique_hosts;
}