summaryrefslogtreecommitdiff
path: root/db/index.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-02-17 11:02:56 -0500
committerEliot Horowitz <eliot@10gen.com>2010-02-17 11:03:39 -0500
commit7700abb01197a0415ae337ac4305a150750d3978 (patch)
tree17d92b71054aa359911a4333f4a1b72dea6cf2e8 /db/index.h
parent8fbc9c34acf011a23238241d55550cea529c58fa (diff)
downloadmongo-7700abb01197a0415ae337ac4305a150750d3978.tar.gz
helpers
Diffstat (limited to 'db/index.h')
-rw-r--r--db/index.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/db/index.h b/db/index.h
index 7708afd644c..573a9770eac 100644
--- a/db/index.h
+++ b/db/index.h
@@ -27,6 +27,7 @@ namespace mongo {
class IndexSpec;
class IndexType; // TODO: this name sucks
+ class IndexPlugin;
/**
* this represents an instance of a index plugin
@@ -36,10 +37,16 @@ namespace mongo {
*/
class IndexType : boost::noncopyable {
public:
+ IndexType( const IndexPlugin * plugin );
virtual ~IndexType();
+
virtual void getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const = 0;
virtual int compare( const IndexSpec& spec , const BSONObj& l , const BSONObj& r ) const;
-
+
+ const IndexPlugin * getPlugin() const { return _plugin; }
+
+ protected:
+ const IndexPlugin * _plugin;
};
/**
@@ -63,6 +70,8 @@ namespace mongo {
return 0;
return i->second;
}
+
+ string getName() const { return _name; }
private:
string _name;
static map<string,IndexPlugin*> * _plugins;
@@ -105,7 +114,16 @@ namespace mongo {
void getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const;
BSONElement missingField() const { return _nullElt; }
+
+ string getTypeName() const {
+ if ( _indexType.get() )
+ return _indexType->getPlugin()->getName();
+ return "";
+ }
+ IndexType* getType() const {
+ return _indexType.get();
+ }
protected:
void _getKeys( vector<const char*> fieldNames , vector<BSONElement> fixed , const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const;
@@ -226,6 +244,8 @@ namespace mongo {
(system.indexes or system.namespaces) -- only NamespaceIndex.
*/
void kill_idx();
+
+ const IndexSpec& getSpec() const;
operator string() const {
return info.obj().toString();