summaryrefslogtreecommitdiff
path: root/src/mongo/bson/oid.cpp
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2015-06-22 12:25:18 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2015-06-26 05:59:45 -0400
commitadd109f525a09d7898a9f00fc083fe5367a939a7 (patch)
tree0860414dabcee68ce04661953c517d0ac3bcdcca /src/mongo/bson/oid.cpp
parent0f59479a8dfdb310c2ccdc99ce6438ce3cbe41a6 (diff)
downloadmongo-add109f525a09d7898a9f00fc083fe5367a939a7.tar.gz
SERVER-18717 compose electionId in OID format from term
Diffstat (limited to 'src/mongo/bson/oid.cpp')
-rw-r--r--src/mongo/bson/oid.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/bson/oid.cpp b/src/mongo/bson/oid.cpp
index a78bcbde682..a8ef6bb56ef 100644
--- a/src/mongo/bson/oid.cpp
+++ b/src/mongo/bson/oid.cpp
@@ -138,6 +138,12 @@ void OID::init() {
setIncrement(Increment::next());
}
+void OID::init(int64_t term) {
+ // each set* method handles endianness
+ setTimestamp(time(0));
+ _view().write<BigEndian<int64_t>>(term, kInstanceUniqueOffset);
+}
+
void OID::init(const std::string& s) {
verify(s.size() == 24);
const char* p = s.c_str();