From 2e68e8bf05fd7c6cb94b82fcfd0fe237c9f7ccb8 Mon Sep 17 00:00:00 2001 From: Randolph Tan Date: Mon, 13 Feb 2017 11:22:40 -0500 Subject: SERVER-27748 Implement LogicalTimeMetadata --- src/mongo/db/SConscript | 1 + src/mongo/db/signed_logical_time.cpp | 2 +- src/mongo/db/signed_logical_time.h | 2 +- src/mongo/db/time_proof_service.h | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/mongo/db') diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 55ea57fe7fc..20aa7fe127e 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -941,6 +941,7 @@ env.Library( ], LIBDEPS=[ 'logical_time', + '$BUILD_DIR/mongo/crypto/sha1_block', ], ) diff --git a/src/mongo/db/signed_logical_time.cpp b/src/mongo/db/signed_logical_time.cpp index bcfb89f027a..16404950ac5 100644 --- a/src/mongo/db/signed_logical_time.cpp +++ b/src/mongo/db/signed_logical_time.cpp @@ -34,7 +34,7 @@ namespace mongo { std::string SignedLogicalTime::toString() const { StringBuilder buf; - buf << _time.toString() << "|" << _proof; + buf << _time.toString() << "|" << _proof.toString(); return buf.str(); } diff --git a/src/mongo/db/signed_logical_time.h b/src/mongo/db/signed_logical_time.h index 52cf1230e58..7b96e51df79 100644 --- a/src/mongo/db/signed_logical_time.h +++ b/src/mongo/db/signed_logical_time.h @@ -36,7 +36,7 @@ namespace mongo { /** * The SignedLogicalTime class is a pair of value i.e. time and a signature i.e. _proof - * The class is immutable and is used to hold the cryptogrphically protected LogicalTime. + * The class is immutable and is used to hold the cryptographically protected LogicalTime. */ class SignedLogicalTime { public: diff --git a/src/mongo/db/time_proof_service.h b/src/mongo/db/time_proof_service.h index bc43e1ceee3..5be6bf46e38 100644 --- a/src/mongo/db/time_proof_service.h +++ b/src/mongo/db/time_proof_service.h @@ -29,6 +29,7 @@ #pragma once #include "mongo/base/status.h" +#include "mongo/crypto/sha1_block.h" #include "mongo/db/logical_time.h" namespace mongo { @@ -40,14 +41,13 @@ namespace mongo { class TimeProofService { public: // This type must be synchronized with the library that generates SHA1 or other proof. - using TimeProof = std::string; + using TimeProof = SHA1Block; /** * Returns the proof matching the time argument. */ TimeProof getProof(LogicalTime time) { - TimeProof proof = "12345678901234567890"; - return proof; + return SHA1Block(); } /** -- cgit v1.2.1