diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2017-08-09 22:40:50 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2017-08-09 22:40:56 -0400 |
commit | 2173ffb9fd23c6894c6820fbf8c08aa876392b55 (patch) | |
tree | 0494ff411eca4010bd0159ecdb2d92b2e2d5e4cc /src/mongo/db/catalog/collection_impl.h | |
parent | bca3f70566991afa2dfb38dc06494b0f6f04fffa (diff) | |
download | mongo-2173ffb9fd23c6894c6820fbf8c08aa876392b55.tar.gz |
SERVER-30353 Create an index observer to notify us of changes made to index and document keys
Diffstat (limited to 'src/mongo/db/catalog/collection_impl.h')
-rw-r--r-- | src/mongo/db/catalog/collection_impl.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h index 4a766faa9aa..1fdfc40d1fa 100644 --- a/src/mongo/db/catalog/collection_impl.h +++ b/src/mongo/db/catalog/collection_impl.h @@ -30,8 +30,12 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/collection_catalog_entry.h" +#include "mongo/db/catalog/index_catalog.h" +#include "mongo/db/concurrency/d_concurrency.h" namespace mongo { +class IndexConsistency; +class IndexObserver; class UUIDCatalog; class CollectionImpl final : virtual public Collection::Impl, virtual CappedCallback, @@ -349,6 +353,15 @@ public: */ const CollatorInterface* getDefaultCollator() const final; + /** + * Calls the Inform function in the IndexObserver if it's hooked. + */ + void informIndexObserver(OperationContext* opCtx, + const IndexDescriptor* descriptor, + const IndexKeyEntry& indexEntry, + const ValidationOperation operation) const; + + private: inline DatabaseCatalogEntry* dbce() const final { return this->_dbce; @@ -359,6 +372,16 @@ private: } /** + * Hooks the IndexObserver into the collection. + */ + void hookIndexObserver(IndexConsistency* consistency); + + /** + * Unhooks the IndexObserver from the collection. + */ + void unhookIndexObserver(); + + /** * Returns a non-ok Status if document does not pass this collection's validator. */ Status checkValidation(OperationContext* opCtx, const BSONObj& document) const; @@ -406,6 +429,9 @@ private: CollectionInfoCache _infoCache; IndexCatalog _indexCatalog; + mutable stdx::mutex _indexObserverMutex; + mutable std::unique_ptr<IndexObserver> _indexObserver; + // The default collation which is applied to operations and indices which have no collation of // their own. The collection's validator will respect this collation. // |