diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-06-22 12:25:18 -0400 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-06-26 05:59:45 -0400 |
commit | add109f525a09d7898a9f00fc083fe5367a939a7 (patch) | |
tree | 0860414dabcee68ce04661953c517d0ac3bcdcca /src/mongo/bson/oid.cpp | |
parent | 0f59479a8dfdb310c2ccdc99ce6438ce3cbe41a6 (diff) | |
download | mongo-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.cpp | 6 |
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(); |