Exemplo n.º 1
0
std::vector<McrouterRouteHandlePtr> ProxyRoute::getAllDestinations() const {
  std::vector<McrouterRouteHandlePtr> rh;
  auto clients = proxy_->getConfig()->getClients();
  for (auto &client : clients) {
    auto dest = proxy_->destinationMap->fetch(*client);
    rh.push_back(makeDestinationRoute(std::move(client), std::move(dest)));
  }
  return rh;
}
Exemplo n.º 2
0
std::pair<std::shared_ptr<ClientPool>, std::vector<McrouterRouteHandlePtr>>
McRouteHandleProvider::makePool(const folly::dynamic& json) {
  checkLogic(json.isString() || json.isObject(),
             "Pool should be a string (name of pool) or an object");
  auto pool = poolFactory_.parsePool(json);
  std::vector<McrouterRouteHandlePtr> destinations;
  for (const auto& client : pool->getClients()) {
    auto pdstn = destinationMap_.fetch(*client);
    auto route = makeDestinationRoute(client, std::move(pdstn));
    destinations.push_back(std::move(route));
  }

  return std::make_pair(std::move(pool), std::move(destinations));
}