summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_set.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-01-28 13:58:11 -0500
committerEliot Horowitz <eliot@10gen.com>2013-02-15 12:41:22 -0500
commitcd299d2c5b00fe869ac0279e7258d352b1bb827e (patch)
tree96d7a9add65a108b1d81a29614ef7deeb47df1db /src/mongo/db/index_set.h
parent31a2028d80848e1770bf91ced08bae9ca7139d58 (diff)
downloadmongo-cd299d2c5b00fe869ac0279e7258d352b1bb827e.tar.gz
SERVER-8173: add a new IndexPathSet class to make checking if a mod will udpate index more reliable
Diffstat (limited to 'src/mongo/db/index_set.h')
-rw-r--r--src/mongo/db/index_set.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mongo/db/index_set.h b/src/mongo/db/index_set.h
new file mode 100644
index 00000000000..51e941c2033
--- /dev/null
+++ b/src/mongo/db/index_set.h
@@ -0,0 +1,45 @@
+// index_set.h
+
+/**
+* Copyright (C) 2008 10gen Inc.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Affero General Public License, version 3,
+* as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Affero General Public License for more details.
+*
+* You should have received a copy of the GNU Affero General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#include <vector>
+
+#include "mongo/base/string_data.h"
+
+namespace mongo {
+
+ /**
+ * a.$ -> a
+ * @return true if out is set and we made a change
+ */
+ bool getCanonicalIndexField( const StringData& fullName, std::string* out );
+
+ class IndexPathSet {
+ public:
+ void addPath( const StringData& path );
+
+ void clear();
+
+ bool mightBeIndexed( const StringData& path ) const;
+
+ private:
+ std::vector<std::string> _canonical;
+ };
+
+}