The KeysCollectionReader is responsible for reading the keys in the admin.system.keys collection.
Its owned by the KeysCollectionManager and started and stopped upon transition to / from config primary to be replaced by the KeysCollectionUpdater.
1. implement KeysCollectionCache abstract class
class KeysCollectionCache { public: /** * Refreshes cache and returns the latest known key */ virtual StatusWith<KeysCollectionDocument> refresh(OperationContext* opCtx) = 0; // gets the keyDoc where min(set{keyDoc.expiresAt > forThisTime}) virtual StatusWith<KeysCollectionDocument> getKey(const LogicalTime& forThisTime) = 0; };
2. The KeysCollectionCacheReader must implement KeysCollectionCache API:
class KeysCollectionCacheReader : public KeysCollectionCache { public: /** * Check if there are new documents expiresAt > latestKeyDoc.expiresAt. */ StatusWith<KeysCollectionDocument> refresh(OperationContext* opCtx) override; StatusWith<KeysCollectionDocument> getKey(const LogicalTime& forThisTime) override; private: std::map<LogicalTime, KeysCollectionDocument> _cache; // expiresAt -> KeysDocument };
- related to
-
SERVER-28436 Implement KeysCollectionManager
- Closed