diff options
Diffstat (limited to 'src/mongo/db/update_index_data.h')
-rw-r--r-- | src/mongo/db/update_index_data.h | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/mongo/db/update_index_data.h b/src/mongo/db/update_index_data.h index d23ee144a67..52113663df0 100644 --- a/src/mongo/db/update_index_data.h +++ b/src/mongo/db/update_index_data.h @@ -36,51 +36,49 @@ namespace mongo { - /** - * a.$ -> a - * @return true if out is set and we made a change - */ - bool getCanonicalIndexField( StringData fullName, std::string* out ); +/** + * a.$ -> a + * @return true if out is set and we made a change + */ +bool getCanonicalIndexField(StringData fullName, std::string* out); +/** + * Holds pre-processed index spec information to allow update to quickly determine if an update + * can be applied as a delta to a document, or if the document must be re-indexed. + */ +class UpdateIndexData { +public: + UpdateIndexData(); + /** - * Holds pre-processed index spec information to allow update to quickly determine if an update - * can be applied as a delta to a document, or if the document must be re-indexed. + * Register a path. Any update targeting this path (or a parent of this path) will + * trigger a recomputation of the document's index keys. */ - class UpdateIndexData { - public: - UpdateIndexData(); - - /** - * Register a path. Any update targeting this path (or a parent of this path) will - * trigger a recomputation of the document's index keys. - */ - void addPath( StringData path ); + void addPath(StringData path); - /** - * Register a path component. Any update targeting a path that contains this exact - * component will trigger a recomputation of the document's index keys. - */ - void addPathComponent( StringData pathComponent ); - - /** - * Register the "wildcard" path. All updates will trigger a recomputation of the document's - * index keys. - */ - void allPathsIndexed(); - - void clear(); + /** + * Register a path component. Any update targeting a path that contains this exact + * component will trigger a recomputation of the document's index keys. + */ + void addPathComponent(StringData pathComponent); - bool mightBeIndexed( StringData path ) const; + /** + * Register the "wildcard" path. All updates will trigger a recomputation of the document's + * index keys. + */ + void allPathsIndexed(); - private: + void clear(); - bool _startsWith( StringData a, StringData b ) const; + bool mightBeIndexed(StringData path) const; - std::set<std::string> _canonicalPaths; - std::set<std::string> _pathComponents; +private: + bool _startsWith(StringData a, StringData b) const; - bool _allPathsIndexed; - }; + std::set<std::string> _canonicalPaths; + std::set<std::string> _pathComponents; + bool _allPathsIndexed; +}; } |