-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
This PR is has only mechanical renames, no re-organization or functional changes occurred. |
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? |
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>
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. |
@htuch PTAL so you don't forget :) |
Signed-off-by: Joshua Marantz <jmarantz@google.com>
There was a problem hiding this 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.
Signed-off-by: Joshua Marantz <jmarantz@google.com>
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()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); } |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. and more :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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