summaryrefslogtreecommitdiff
path: root/src/mongo/db/logical_clock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/logical_clock.h')
-rw-r--r--src/mongo/db/logical_clock.h66
1 files changed, 12 insertions, 54 deletions
diff --git a/src/mongo/db/logical_clock.h b/src/mongo/db/logical_clock.h
index 001d91eb9e6..6d0b73385e5 100644
--- a/src/mongo/db/logical_clock.h
+++ b/src/mongo/db/logical_clock.h
@@ -38,10 +38,7 @@ class OperationContext;
/**
* LogicalClock maintain the clusterTime for a clusterNode. Every cluster node in a replica set has
- * an instance of the LogicalClock installed as a ServiceContext decoration. LogicalClock owns the
- * TimeProofService that allows it to generate proofs to sign LogicalTime values and to validate the
- * proofs of SignedLogicalTime values.LogicalClock instance must be created before the instance
- * starts up.
+ * an instance of the LogicalClock installed as a ServiceContext decoration.
*/
class LogicalClock {
public:
@@ -59,40 +56,17 @@ public:
LogicalClock(ServiceContext*);
/**
- * Attach a pointer to a TimeProofService to the logical clock. Will overwrite an existing
- * pointer if a TimeProofService has already been attached.
- */
- void setTimeProofService(std::unique_ptr<TimeProofService>);
-
- /**
- * Returns true if a TimeProofService has been attached to the logical clock.
- */
- bool canVerifyAndSign();
-
- /**
- * The method sets clusterTime to the newTime if the newTime > _clusterTime and the newTime
- * passes the rate check and proof validation.
- * Returns an error if the newTime does not pass the rate check or proof validation,
- * OK otherwise.
- */
- Status advanceClusterTime(const SignedLogicalTime&);
-
- /**
- * Similar to advanceClusterTime, but only does rate checking and not proof validation.
- */
- Status advanceClusterTimeFromTrustedSource(SignedLogicalTime newTime);
-
- /**
- * Similar to advanceClusterTimeFromTrustedSource, but also signs the new time. Note that this
- * should only be used on trusted LogicalTime (for example, LogicalTime extracted from local
- * oplog entry).
+ * The method sets current time to newTime if the newTime > current time and it passes the rate
+ * check.
+ *
+ * Returns an error if the newTime does not pass the rate check.
*/
- Status signAndAdvanceClusterTime(LogicalTime newTime);
+ Status advanceClusterTime(const LogicalTime newTime);
/**
* Returns the current clusterTime.
*/
- SignedLogicalTime getClusterTime();
+ LogicalTime getClusterTime();
/**
* Returns the next clusterTime value and provides a guarantee that any future call to
@@ -102,20 +76,13 @@ public:
LogicalTime reserveTicks(uint64_t nTicks);
/**
- * Resets _clusterTime to the signed time created from newTime. Should be used at the
- * initialization after reading the oplog. Must not be called on already initialized clock.
+ * Resets current time to newTime. Should only be used for initializing this clock from an
+ * oplog timestamp.
*/
- void initClusterTimeFromTrustedSource(LogicalTime newTime);
+ void setClusterTimeFromTrustedSource(LogicalTime newTime);
private:
/**
- * Utility to create valid SignedLogicalTime from LogicalTime.
- */
- SignedLogicalTime _makeSignedLogicalTime_inlock(LogicalTime);
-
- Status _advanceClusterTime_inlock(SignedLogicalTime newTime);
-
- /**
* Rate limiter for advancing logical time. Rejects newTime if its seconds value is more than
* kMaxAcceptableLogicalClockDrift seconds ahead of this node's wall clock.
*/
@@ -123,18 +90,9 @@ private:
ServiceContext* const _service;
- // The mutex protects _clusterTime and _timeProofService.
+ // The mutex protects _clusterTime.
stdx::mutex _mutex;
- SignedLogicalTime _clusterTime;
- std::unique_ptr<TimeProofService> _timeProofService;
-
- /**
- * Temporary key only used for unit tests.
- *
- * TODO: SERVER-28436 Implement KeysCollectionManager
- * Remove _tempKey and its uses from logical clock, and pass actual key from key manager.
- */
- TimeProofService::Key _tempKey = {};
+ LogicalTime _clusterTime;
};
} // namespace mongo