Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

feat!: change the result type for timers to StatusOr #134

Merged
merged 2 commits into from
Jan 27, 2020
Merged

feat!: change the result type for timers to StatusOr #134

merged 2 commits into from
Jan 27, 2020

Conversation

mr-salty
Copy link
Contributor

@mr-salty mr-salty commented Jan 24, 2020

The result of the future returned from MakeDeadlineTimer and
MakeRelativeTimer is now a StatusOr that indicates whether the
timer ran to expiration or not (e.g. it was Cancelled).

BREAKING CHANGE: Most callers of MakeDeadlineTimer or MakeRelativeTimer will need to be updated.

Part of #129


This change is Reviewable

The result of the `future` returned from `MakeDeadlineTimer` and
`MakeRelativeTimer` is now a `StatusOr` that indicates whether the
timer ran to expiration or not (e.g. it was Cancelled).

Part of #129
@mr-salty mr-salty requested review from coryan and devbww January 24, 2020 23:39
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 24, 2020
@codecov
Copy link

codecov bot commented Jan 24, 2020

Codecov Report

Merging #134 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #134      +/-   ##
==========================================
+ Coverage   96.36%   96.36%   +<.01%     
==========================================
  Files          82       82              
  Lines        3655     3660       +5     
==========================================
+ Hits         3522     3527       +5     
  Misses        133      133
Impacted Files Coverage Δ
google/cloud/grpc_utils/completion_queue.cc 100% <100%> (ø) ⬆️
google/cloud/grpc_utils/completion_queue.h 100% <100%> (ø) ⬆️
google/cloud/grpc_utils/completion_queue_test.cc 100% <100%> (ø) ⬆️
...cloud/grpc_utils/internal/completion_queue_impl.cc 85.5% <0%> (-0.41%) ⬇️
.../cloud/grpc_utils/internal/completion_queue_impl.h 100% <0%> (ø) ⬆️
google/cloud/status_or.h 96.51% <0%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 672072a...54a960d. Read the comment docs.

@@ -70,11 +73,15 @@ TEST(CompletionQueueTest, ShutdownWithPending) {
using ms = std::chrono::milliseconds;

future<void> timer;
future<void> timer2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused?

@@ -54,8 +54,10 @@ class CompletionQueue {
* @param deadline when should the timer expire.
*
* @return a future that becomes satisfied after @p deadline.
* The result of the future is the time at which it expired, or an error
* Status if the timer did not run to expiration(e.g. it was Cancelled).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: s/(e.g. it was Cancelled)/ (e.g., it was cancelled)/

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

Looks good once you address the comments that @devbww made.

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @devbww and @mr-salty)


google/cloud/grpc_utils/completion_queue.h, line 58 at r1 (raw file):

Previously, devbww (Bradley White) wrote…

Nit: s/(e.g. it was Cancelled)/ (e.g., it was cancelled)/

nit: we also indent follow on lines, e.g.:

  * @return a future that becomes satisfied after @p deadline or if
  *      an error if the timer fails to run until expiration.

google/cloud/grpc_utils/completion_queue.h, line 80 at r1 (raw file):

   *
   * @return a future that becomes satisfied after @p duration time has elapsed.
   * The result of the future is the time at which it expired, or an error

nit: indent after @return


google/cloud/grpc_utils/completion_queue_test.cc, line 102 at r1 (raw file):

    done.set_value();
  });
  for (int i = 0; i < 3; ++i) {

nit: i != 3 ?

Copy link
Contributor Author

@mr-salty mr-salty left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @devbww)


google/cloud/grpc_utils/completion_queue.h, line 58 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

nit: we also indent follow on lines, e.g.:

  * @return a future that becomes satisfied after @p deadline or if
  *      an error if the timer fails to run until expiration.

Done (both). Would be nice if clang-format could do the latter but I don't see any options like that.


google/cloud/grpc_utils/completion_queue.h, line 80 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

nit: indent after @return

Done


google/cloud/grpc_utils/completion_queue_test.cc, line 76 at r1 (raw file):

Previously, devbww (Bradley White) wrote…

Unused?

done (oops, it was an experiment)


google/cloud/grpc_utils/completion_queue_test.cc, line 102 at r1 (raw file):

Previously, coryan (Carlos O'Ryan) wrote…

nit: i != 3 ?

I'm gonna have to call that "personal preference" instead of "nit"...

@mr-salty
Copy link
Contributor Author

PTAL

Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @devbww)

@mr-salty mr-salty merged commit f5201ab into googleapis:master Jan 27, 2020
@mr-salty mr-salty deleted the timerok branch January 27, 2020 20:46
coryan pushed a commit to coryan/google-cloud-cpp that referenced this pull request Apr 24, 2020
…le-cloud-cpp-common#134)

The result of the `future` returned from `MakeDeadlineTimer` and`MakeRelativeTimer` is now a `StatusOr` that indicates whether the timer ran to expiration or not (e.g. it was cancelled).

Part of googleapis/google-cloud-cpp-common#129
coryan pushed a commit to coryan/google-cloud-cpp that referenced this pull request Apr 24, 2020
…le-cloud-cpp-common#134)

The result of the `future` returned from `MakeDeadlineTimer` and`MakeRelativeTimer` is now a `StatusOr` that indicates whether the timer ran to expiration or not (e.g. it was cancelled).

Part of googleapis/google-cloud-cpp-common#129
coryan pushed a commit to coryan/google-cloud-cpp that referenced this pull request Apr 24, 2020
…le-cloud-cpp-common#134)

The result of the `future` returned from `MakeDeadlineTimer` and`MakeRelativeTimer` is now a `StatusOr` that indicates whether the timer ran to expiration or not (e.g. it was cancelled).

Part of googleapis/google-cloud-cpp-common#129
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants