diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2021-01-11 05:14:06 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-01-15 22:47:49 +0000 |
commit | ae738118f9f8f6ef93bc4482489cab9955a2bcb1 (patch) | |
tree | 3b6b21db4f7766de948666b6b5b188890f58dd35 /src/mongo/db/keys_collection_client_direct.h | |
parent | f99876a23cd41e89331a2fb2a3c3d799e2b514a7 (diff) | |
download | mongo-ae738118f9f8f6ef93bc4482489cab9955a2bcb1.tar.gz |
SERVER-53403 Support validating cluster times with keys from external_validation_keys
Diffstat (limited to 'src/mongo/db/keys_collection_client_direct.h')
-rw-r--r-- | src/mongo/db/keys_collection_client_direct.h | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/mongo/db/keys_collection_client_direct.h b/src/mongo/db/keys_collection_client_direct.h index 3b101d99167..9cd71aad750 100644 --- a/src/mongo/db/keys_collection_client_direct.h +++ b/src/mongo/db/keys_collection_client_direct.h @@ -45,13 +45,24 @@ class KeysCollectionClientDirect : public KeysCollectionClient { public: KeysCollectionClientDirect(); /** - * Returns keys for the given purpose and with an expiresAt value greater than newerThanThis, - * using readConcern level majority if possible. + * Returns keys in admin.system.keys that match the given purpose and have an expiresAt value + * greater than newerThanThis. Uses readConcern level majority if possible. */ - StatusWith<std::vector<KeysCollectionDocument>> getNewKeys(OperationContext* opCtx, - StringData purpose, - const LogicalTime& newerThanThis, - bool useMajority) override; + StatusWith<std::vector<KeysCollectionDocument>> getNewInternalKeys( + OperationContext* opCtx, + StringData purpose, + const LogicalTime& newerThanThis, + bool useMajority) override; + + /** + * Returns keys in admin.system.external_validation_keys that match the given purpose and have + * an expiresAt value greater than newerThanThis. Uses readConcern level majority if possible. + */ + StatusWith<std::vector<ExternalKeysCollectionDocument>> getNewExternalKeys( + OperationContext* opCtx, + StringData purpose, + const LogicalTime& newerThanThis, + bool useMajority) override; /** * Directly inserts a key document to the storage @@ -67,6 +78,17 @@ public: } private: + /** + * Returns keys in the given collection that match the given purpose and have an expiresAt value + * greater than newerThanThis, using readConcern level majority if possible. + */ + template <typename KeyDocumentType> + StatusWith<std::vector<KeyDocumentType>> _getNewKeys(OperationContext* opCtx, + const NamespaceString& nss, + StringData purpose, + const LogicalTime& newerThanThis, + bool useMajority); + StatusWith<Shard::QueryResponse> _query(OperationContext* opCtx, const ReadPreferenceSetting& readPref, const repl::ReadConcernLevel& readConcernLevel, |