Skip to content

Commit

Permalink
use uint64_t as rds manager_identifier
Browse files Browse the repository at this point in the history
Signed-off-by: Quanjie Lin <quanlin@google.com>
  • Loading branch information
quanjielin committed Feb 8, 2019
1 parent b7957ec commit cffd4e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions source/common/router/rds_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ StaticRouteConfigProviderImpl::~StaticRouteConfigProviderImpl() {
// initialization needs to be fixed.
RdsRouteConfigSubscription::RdsRouteConfigSubscription(
const envoy::config::filter::network::http_connection_manager::v2::Rds& rds,
const std::string& manager_identifier, Server::Configuration::FactoryContext& factory_context,
const uint64_t& manager_identifier, Server::Configuration::FactoryContext& factory_context,
const std::string& stat_prefix,
Envoy::Router::RouteConfigProviderManagerImpl& route_config_provider_manager)
: route_config_name_(rds.route_config_name()),
Expand Down Expand Up @@ -194,9 +194,7 @@ Router::RouteConfigProviderPtr RouteConfigProviderManagerImpl::createRdsRouteCon
Server::Configuration::FactoryContext& factory_context, const std::string& stat_prefix) {

// RdsRouteConfigSubscriptions are unique based on their serialized RDS config.
// TODO(htuch): Full serialization here gives large IDs, could get away with a
// strong hash instead.
const std::string manager_identifier = std::to_string(MessageUtil::hash(rds));
const uint64_t manager_identifier = MessageUtil::hash(rds);

RdsRouteConfigSubscriptionSharedPtr subscription;

Expand Down
8 changes: 5 additions & 3 deletions source/common/router/rds_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RdsRouteConfigSubscription

RdsRouteConfigSubscription(
const envoy::config::filter::network::http_connection_manager::v2::Rds& rds,
const std::string& manager_identifier, Server::Configuration::FactoryContext& factory_context,
const uint64_t& manager_identifier, Server::Configuration::FactoryContext& factory_context,
const std::string& stat_prefix,
RouteConfigProviderManagerImpl& route_config_provider_manager);

Expand All @@ -134,7 +134,7 @@ class RdsRouteConfigSubscription
Stats::ScopePtr scope_;
RdsStats stats_;
RouteConfigProviderManagerImpl& route_config_provider_manager_;
const std::string manager_identifier_;
const uint64_t manager_identifier_;
TimeSource& time_source_;
SystemTime last_updated_;
absl::optional<LastConfigInfo> config_info_;
Expand Down Expand Up @@ -202,7 +202,9 @@ class RouteConfigProviderManagerImpl : public RouteConfigProviderManager,
// TODO(jsedgwick) These two members are prime candidates for the owned-entry list/map
// as in ConfigTracker. I.e. the ProviderImpls would have an EntryOwner for these lists
// Then the lifetime management stuff is centralized and opaque.
std::unordered_map<std::string, std::weak_ptr<RdsRouteConfigSubscription>>
//std::unordered_map<std::string, std::weak_ptr<RdsRouteConfigSubscription>>
// route_config_subscriptions_;
std::unordered_map<uint64_t, std::weak_ptr<RdsRouteConfigSubscription>>
route_config_subscriptions_;
std::unordered_set<RouteConfigProvider*> static_route_config_providers_;
Server::ConfigTracker::EntryOwnerPtr config_tracker_entry_;
Expand Down

0 comments on commit cffd4e9

Please sign in to comment.