Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: Rename time_source_ and timeSource() to time_system_ and timeSystem() as appropriate #4343

Merged
merged 7 commits into from
Sep 7, 2018

Conversation

jmarantz
Copy link
Contributor

@jmarantz jmarantz commented Sep 5, 2018

Description: In #4257, Event::TimeSystem was introduced to augment the TimeSource abstraction to include timers. Most places in the system that had previously held onto a TimeSource held it in a member variable time_source_ and, if appropriate, exposed it as a method timeSource(), and #4257 changed those to Event::TimeSystem without renaming them, in order to minimize diffs. This PR just renames the members and methods to time_system_ and timeSystem() as appropriate. This is part of the chain of CLs to resolve #4160.

Risk Level: low -- no functional risk, but depending on timing of when this gets merged, an easily-remedied build breakage could arise.
Testing: //test/...
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz jmarantz changed the title toime: Rename time_source_ and timeSource() to time_system_ and timeSystem() as appropriate time: Rename time_source_ and timeSource() to time_system_ and timeSystem() as appropriate Sep 5, 2018
@jmarantz
Copy link
Contributor Author

jmarantz commented Sep 5, 2018

This PR is has only mechanical renames, no re-organization or functional changes occurred.

@dnoe
Copy link
Contributor

dnoe commented Sep 5, 2018

Are all three of your time-related PRs independent or is there any desired order of review/merging that will make people's lives easier?

@jmarantz
Copy link
Contributor Author

jmarantz commented Sep 5, 2018

The 3 are independent, especially the one that adds simulated time. This one can be reviewed either before or after #4341 but after one is merged, I believe the other one will need a minor fix before it can be merged.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Contributor Author

jmarantz commented Sep 6, 2018

It would be good to review this one soon if possible; the sooner it gets in, the less time dealing with merge conflicts. It's entirely mechanical.

@jmarantz
Copy link
Contributor Author

jmarantz commented Sep 6, 2018

@htuch PTAL so you don't forget :)

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmarantz it looks like there is still a fair bit of type/name mismatch in this PR; in some places it is introducing new sites where the name/type don't align.

include/envoy/server/filter_config.h Outdated Show resolved Hide resolved
include/envoy/upstream/cluster_manager.h Outdated Show resolved Hide resolved
source/common/common/token_bucket_impl.h Outdated Show resolved Hide resolved
@htuch htuch self-assigned this Sep 6, 2018
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Contributor Author

jmarantz commented Sep 7, 2018

Sorry about that; I had not scrutinized the diffs enough after sedding. Now I've made sure all declarations are consistent with variable names. Note that we still in places initialize a TimeSource& with a Event::TimeSystem&, which is fine as Event::TimeSystem inherits from TimeSource.

@@ -14,7 +14,7 @@ GrpcMuxImpl::GrpcMuxImpl(const LocalInfo::LocalInfo& local_info, Grpc::AsyncClie
const Protobuf::MethodDescriptor& service_method,
Runtime::RandomGenerator& random)
: local_info_(local_info), async_client_(std::move(async_client)),
service_method_(service_method), random_(random), time_source_(dispatcher.timeSource()) {
service_method_(service_method), random_(random), time_source_(dispatcher.timeSystem()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems to still not match.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAI. The dispatcher keeps a TimeSystem because it works with timers. However, gRPC doesn't care about timers (yet) so it needs only a TimeSource. So when testing this, all you need is (say) a MockTimeSource, and don't need to set up a whole TimeSystem.

This is true with all the cases below as well.

@@ -165,7 +165,7 @@ class GoogleAsyncClientImpl final : public AsyncClient, Logger::Loggable<Logger:
AsyncStream* start(const Protobuf::MethodDescriptor& service_method,
AsyncStreamCallbacks& callbacks) override;

TimeSource& timeSource() { return dispatcher_.timeSource(); }
TimeSource& timeSource() { return dispatcher_.timeSystem(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -180,7 +180,7 @@ ClusterManagerImpl::ClusterManagerImpl(const envoy::config::bootstrap::v2::Boots
init_helper_([this](Cluster& cluster) { onClusterInit(cluster); }),
config_tracker_entry_(
admin.getConfigTracker().add("clusters", [this] { return dumpClusterConfigs(); })),
time_source_(main_thread_dispatcher.timeSource()), dispatcher_(main_thread_dispatcher) {
time_source_(main_thread_dispatcher.timeSystem()), dispatcher_(main_thread_dispatcher) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also

@@ -16,7 +16,7 @@ LoadStatsReporter::LoadStatsReporter(const LocalInfo::LocalInfo& local_info,
async_client_(std::move(async_client)),
service_method_(*Protobuf::DescriptorPool::generated_pool()->FindMethodByName(
"envoy.service.load_stats.v2.LoadReportingService.StreamLoadStats")),
time_source_(dispatcher.timeSource()) {
time_source_(dispatcher.timeSystem()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. and more :)

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@htuch htuch merged commit c886007 into envoyproxy:master Sep 7, 2018
@jmarantz jmarantz deleted the time-source-to-system branch September 7, 2018 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integration tests should use simulated time
3 participants