diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2020-12-17 11:27:03 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-12-17 17:51:47 +0000 |
commit | 537641adca3ef2134c11322637b6bc4723af7611 (patch) | |
tree | 59600df47d6f269965f2c06e72d54060ad8ca786 /src/mongo/bson | |
parent | 859b72ae51e1c1cce996a4afe86ee3951500e55d (diff) | |
download | mongo-537641adca3ef2134c11322637b6bc4723af7611.tar.gz |
SERVER-52789: Add mechanism to allow pinning of the oldest timestamps.
Diffstat (limited to 'src/mongo/bson')
-rw-r--r-- | src/mongo/bson/timestamp.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/bson/timestamp.h b/src/mongo/bson/timestamp.h index 924b26aea11..4342f93c39e 100644 --- a/src/mongo/bson/timestamp.h +++ b/src/mongo/bson/timestamp.h @@ -56,9 +56,8 @@ public: } /** - * DEPRECATED Constructor that builds a Timestamp from a Date_t by using the - * high-order 4 bytes of "date" for the "secs" field and the low-order 4 bytes - * for the "i" field. + * Constructor that builds a Timestamp from a Date_t by using the high-order 4 bytes of "date" + * for the "secs" field and the low-order 4 bytes for the "i" field. */ explicit Timestamp(Date_t date) : Timestamp(date.toULL()) {} @@ -67,7 +66,7 @@ public: * the high-order 4 bytes of "v" for the "secs" field and the low-order 4 bytes for the "i" * field. */ - explicit Timestamp(unsigned long long v) : Timestamp(v >> 32, v) {} + explicit Timestamp(unsigned long long val) : Timestamp(val >> 32, val) {} Timestamp(Seconds s, unsigned increment) : Timestamp(s.count(), increment) {} @@ -120,6 +119,14 @@ public: return tie() >= r.tie(); } + Timestamp operator+(unsigned long long inc) const { + return Timestamp(asULL() + inc); + } + + Timestamp operator-(unsigned long long inc) const { + return Timestamp(asULL() - inc); + } + // Append the BSON representation of this Timestamp to the given BufBuilder with the given // name. This lives here because Timestamp manages its own serialization format. |