diff options
Diffstat (limited to 'src/mongo/db/ttl_collection_cache.h')
| -rw-r--r-- | src/mongo/db/ttl_collection_cache.h | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/src/mongo/db/ttl_collection_cache.h b/src/mongo/db/ttl_collection_cache.h index a8f00b6c6a6..8c70ce9f8d8 100644 --- a/src/mongo/db/ttl_collection_cache.h +++ b/src/mongo/db/ttl_collection_cache.h @@ -54,52 +54,16 @@ public: using IndexName = std::string; // Specifies how a collection should expire data with TTL. - class Info { - public: - explicit Info(ClusteredId) : _isClustered(true), _isExpireAfterSecondsNaN(false) {} - Info(IndexName indexName, bool isExpireAfterSecondsNaN) - : _isClustered(false), - _indexName(std::move(indexName)), - _isExpireAfterSecondsNaN(isExpireAfterSecondsNaN) {} - bool isClustered() const { - return _isClustered; - } - IndexName getIndexName() const { - return _indexName; - } - bool isExpireAfterSecondsNaN() const { - return _isExpireAfterSecondsNaN; - } - void unsetExpireAfterSecondsNaN() { - _isExpireAfterSecondsNaN = false; - } - - private: - bool _isClustered; - IndexName _indexName; - bool _isExpireAfterSecondsNaN; - }; + using Info = stdx::variant<ClusteredId, IndexName>; // Caller is responsible for ensuring no duplicates are registered. void registerTTLInfo(UUID uuid, const Info& info); - void deregisterTTLIndexByName(UUID uuid, const IndexName& indexName); - void deregisterTTLClusteredIndex(UUID uuid); - - /** - * Resets expireAfterSeconds flag on TTL index. - * For idempotency, this has no effect if index is not found. - */ - void unsetTTLIndexExpireAfterSecondsNaN(UUID uuid, const IndexName& indexName); + void deregisterTTLInfo(UUID uuid, const Info& info); using InfoMap = stdx::unordered_map<UUID, std::vector<Info>, UUID::Hash>; InfoMap getTTLInfos(); private: - /** - * Shared implementation for deregistering TTL infos. - */ - void _deregisterTTLInfo(UUID uuid, const Info& info); - Mutex _ttlInfosLock = MONGO_MAKE_LATCH("TTLCollectionCache::_ttlInfosLock"); InfoMap _ttlInfos; }; |
