kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] branch master updated: [clock] modernize clock-related classes
Date Tue, 01 Oct 2019 06:27:59 GMT
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ddeda6  [clock] modernize clock-related classes
8ddeda6 is described below

commit 8ddeda605c3378220efb506cf24158978f87928b
Author: Alexey Serbin <alexey@apache.org>
AuthorDate: Fri Sep 27 12:39:27 2019 -0700

    [clock] modernize clock-related classes
    
    This patch updates the signature of clock-related classes to
    appropriate C++11 keywords instead of macro.
    
    This changelist doesn't contain any functional changes.
    
    Change-Id: I476a55189d4131d7a749db22dcf6f8b2af25b521
    Reviewed-on: http://gerrit.cloudera.org:8080/14330
    Tested-by: Alexey Serbin <aserbin@cloudera.com>
    Reviewed-by: Adar Dembo <adar@cloudera.com>
---
 src/kudu/clock/clock.h              |  3 +--
 src/kudu/clock/hybrid_clock-test.cc |  6 +++---
 src/kudu/clock/hybrid_clock.h       | 32 ++++++++++++++++----------------
 src/kudu/clock/logical_clock.h      | 24 ++++++++++++------------
 src/kudu/clock/system_ntp.h         |  8 ++++----
 src/kudu/clock/system_unsync_time.h |  6 +++---
 6 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/src/kudu/clock/clock.h b/src/kudu/clock/clock.h
index b4a199a..e9a0404 100644
--- a/src/kudu/clock/clock.h
+++ b/src/kudu/clock/clock.h
@@ -42,6 +42,7 @@ namespace clock {
 // 2 - Update() must never set the clock backwards (corollary of 1)
 class Clock : public RefCountedThreadSafe<Clock> {
  public:
+  virtual ~Clock() = default;
 
   // Initializes the clock.
   virtual Status Init() = 0;
@@ -107,8 +108,6 @@ class Clock : public RefCountedThreadSafe<Clock> {
 
   // Strigifies the provided timestamp according to this clock's internal format.
   virtual std::string Stringify(Timestamp timestamp) = 0;
-
-  virtual ~Clock() {}
 };
 
 } // namespace clock
diff --git a/src/kudu/clock/hybrid_clock-test.cc b/src/kudu/clock/hybrid_clock-test.cc
index 9282bfd..837bc9a 100644
--- a/src/kudu/clock/hybrid_clock-test.cc
+++ b/src/kudu/clock/hybrid_clock-test.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/clock/hybrid_clock.h"
+
 #include <algorithm>
 #include <cstdint>
 #include <string>
@@ -25,12 +27,10 @@
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include "kudu/clock/hybrid_clock.h"
 #include "kudu/clock/mock_ntp.h"
 #include "kudu/clock/time_service.h"
 #include "kudu/common/timestamp.h"
 #include "kudu/gutil/casts.h"
-#include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/util/atomic.h"
@@ -58,7 +58,7 @@ class HybridClockTest : public KuduTest {
       : clock_(new HybridClock) {
   }
 
-  virtual void SetUp() OVERRIDE {
+  void SetUp() override {
     KuduTest::SetUp();
     ASSERT_OK(clock_->Init());
   }
diff --git a/src/kudu/clock/hybrid_clock.h b/src/kudu/clock/hybrid_clock.h
index db4cfef..22c17ed 100644
--- a/src/kudu/clock/hybrid_clock.h
+++ b/src/kudu/clock/hybrid_clock.h
@@ -42,32 +42,32 @@ class HybridClock : public Clock {
  public:
   HybridClock();
 
-  virtual Status Init() OVERRIDE;
+  Status Init() override;
 
   // Obtains the timestamp corresponding to the current time.
-  virtual Timestamp Now() OVERRIDE;
+  Timestamp Now() override;
 
   // Obtains the timestamp corresponding to latest possible current
   // time.
-  virtual Timestamp NowLatest() OVERRIDE;
+  Timestamp NowLatest() override;
 
   // Obtain a timestamp which is guaranteed to be later than the current time
   // on any machine in the cluster.
   //
   // NOTE: this is not a very tight bound.
-  virtual Status GetGlobalLatest(Timestamp* t) OVERRIDE;
+  Status GetGlobalLatest(Timestamp* t) override;
 
   // Updates the clock with a timestamp originating on another machine.
-  virtual Status Update(const Timestamp& to_update) OVERRIDE;
+  Status Update(const Timestamp& to_update) override;
 
-  virtual void RegisterMetrics(const scoped_refptr<MetricEntity>& metric_entity)
OVERRIDE;
+  void RegisterMetrics(const scoped_refptr<MetricEntity>& metric_entity) override;
 
   // HybridClock supports all external consistency modes.
-  virtual bool SupportsExternalConsistencyMode(ExternalConsistencyMode mode) OVERRIDE;
+  bool SupportsExternalConsistencyMode(ExternalConsistencyMode mode) override;
 
-  virtual bool HasPhysicalComponent() const OVERRIDE;
+  bool HasPhysicalComponent() const override;
 
-  MonoDelta GetPhysicalComponentDifference(Timestamp lhs, Timestamp rhs) const OVERRIDE;
+  MonoDelta GetPhysicalComponentDifference(Timestamp lhs, Timestamp rhs) const override;
 
   // Blocks the caller thread until the true time is after 'then'.
   // In other words, waits until the HybridClock::Now() on _all_ nodes
@@ -99,8 +99,8 @@ class HybridClock : public Clock {
   // This is because, by looking at the current clock, we can know how long
   // we'll have to wait, in contrast to most Wait() methods which are waiting
   // on some external condition to become true.
-  virtual Status WaitUntilAfter(const Timestamp& then,
-                                const MonoTime& deadline) OVERRIDE;
+  Status WaitUntilAfter(const Timestamp& then,
+                        const MonoTime& deadline) override;
 
   // Blocks the caller thread until the local time is after 'then'.
   // This is in contrast to the above method, which waits until the time
@@ -109,8 +109,8 @@ class HybridClock : public Clock {
   // Returns Status::TimedOut() if 'deadline' will pass before the specified
   // timestamp. NOTE: unlike most "wait" methods, this may return _immediately_
   // with a timeout. See WaitUntilAfter() for details.
-  virtual Status WaitUntilAfterLocally(const Timestamp& then,
-                                       const MonoTime& deadline) OVERRIDE;
+  Status WaitUntilAfterLocally(const Timestamp& then,
+                               const MonoTime& deadline) override;
 
   // Return true if the given time has passed (i.e any future call
   // to Now() would return a higher value than t).
@@ -118,7 +118,9 @@ class HybridClock : public Clock {
   // NOTE: this only refers to the _local_ clock, and is not a guarantee
   // that other nodes' clocks have definitely passed this timestamp.
   // This is in contrast to WaitUntilAfter() above.
-  virtual bool IsAfter(Timestamp t) OVERRIDE;
+  bool IsAfter(Timestamp t) override;
+
+  std::string Stringify(Timestamp timestamp) override;
 
   // Obtains the timestamp corresponding to the current time and the associated
   // error in micros. This may fail if the clock is unsynchronized or synchronized
@@ -126,8 +128,6 @@ class HybridClock : public Clock {
   // LOG(FATAL)'s in that case.
   void NowWithError(Timestamp* timestamp, uint64_t* max_error_usec);
 
-  virtual std::string Stringify(Timestamp timestamp) OVERRIDE;
-
   // Static encoding/decoding methods for timestamps. Public mostly
   // for testing/debugging purposes.
 
diff --git a/src/kudu/clock/logical_clock.h b/src/kudu/clock/logical_clock.h
index 8d087a1..e4da536 100644
--- a/src/kudu/clock/logical_clock.h
+++ b/src/kudu/clock/logical_clock.h
@@ -48,33 +48,33 @@ namespace clock {
 class LogicalClock : public Clock {
  public:
 
-  virtual Status Init() OVERRIDE { return Status::OK(); }
+  Status Init() override { return Status::OK(); }
 
-  virtual Timestamp Now() OVERRIDE;
+  Timestamp Now() override;
 
   // In the logical clock this call is equivalent to Now();
-  virtual Timestamp NowLatest() OVERRIDE;
+  Timestamp NowLatest() override;
 
-  virtual Status Update(const Timestamp& to_update) OVERRIDE;
+  Status Update(const Timestamp& to_update) override;
 
   // The Wait*() functions are not available for this clock.
-  virtual Status WaitUntilAfter(const Timestamp& then,
-                                const MonoTime& deadline) OVERRIDE;
-  virtual Status WaitUntilAfterLocally(const Timestamp& then,
-                                       const MonoTime& deadline) OVERRIDE;
+  Status WaitUntilAfter(const Timestamp& then,
+                        const MonoTime& deadline) override;
+  Status WaitUntilAfterLocally(const Timestamp& then,
+                               const MonoTime& deadline) override;
 
-  virtual bool IsAfter(Timestamp t) OVERRIDE;
+  bool IsAfter(Timestamp t) override;
 
-  virtual void RegisterMetrics(const scoped_refptr<MetricEntity>& metric_entity)
OVERRIDE;
+  void RegisterMetrics(const scoped_refptr<MetricEntity>& metric_entity) override;
 
-  virtual std::string Stringify(Timestamp timestamp) OVERRIDE;
+  std::string Stringify(Timestamp timestamp) override;
 
   // Used to get the timestamp without incrementing the logical component.
   // Mostly used for tests/metrics.
   uint64_t GetCurrentTime();
 
   // Logical clock doesn't support COMMIT_WAIT.
-  virtual bool SupportsExternalConsistencyMode(ExternalConsistencyMode mode) OVERRIDE {
+  bool SupportsExternalConsistencyMode(ExternalConsistencyMode mode) override {
     return mode != COMMIT_WAIT;
   }
 
diff --git a/src/kudu/clock/system_ntp.h b/src/kudu/clock/system_ntp.h
index 3b3a723..1612595 100644
--- a/src/kudu/clock/system_ntp.h
+++ b/src/kudu/clock/system_ntp.h
@@ -38,17 +38,17 @@ class SystemNtp : public TimeService {
  public:
   SystemNtp();
 
-  virtual Status Init() override {
+  Status Init() override {
     return Status::OK();
   }
 
-  virtual Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override;
+  Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override;
 
-  virtual int64_t skew_ppm() const override {
+  int64_t skew_ppm() const override {
     return skew_ppm_;
   }
 
-  virtual void DumpDiagnostics(std::vector<std::string>* log) const override;
+  void DumpDiagnostics(std::vector<std::string>* log) const override;
 
  private:
   // The scaling factor used to obtain ppms. From the adjtimex source:
diff --git a/src/kudu/clock/system_unsync_time.h b/src/kudu/clock/system_unsync_time.h
index 455b321..5179b3f 100644
--- a/src/kudu/clock/system_unsync_time.h
+++ b/src/kudu/clock/system_unsync_time.h
@@ -34,11 +34,11 @@ class SystemUnsyncTime : public TimeService {
  public:
   SystemUnsyncTime() = default;
 
-  virtual Status Init() override;
+  Status Init() override;
 
-  virtual Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override;
+  Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override;
 
-  virtual int64_t skew_ppm() const override {
+  int64_t skew_ppm() const override {
     return 500; // Reasonable default value.
   }
 


Mime
View raw message