mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
clean plugin stuff
This commit is contained in:
parent
d1e3572f45
commit
f485e25f82
@ -98,7 +98,6 @@ namespace mongo {
|
||||
}
|
||||
|
||||
void IndexSpec::_init(){
|
||||
_indexType = 0;
|
||||
assert( keyPattern.objsize() );
|
||||
|
||||
string pluginName = "";
|
||||
@ -130,14 +129,14 @@ namespace mongo {
|
||||
log() << "warning: can't find plugin [" << pluginName << "]" << endl;
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
_indexType.reset( plugin->generate( this ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IndexSpec::getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const {
|
||||
if ( _indexType ){
|
||||
if ( _indexType.get() ){
|
||||
_indexType->getKeys( obj , keys );
|
||||
return;
|
||||
}
|
||||
|
10
db/index.h
10
db/index.h
@ -53,7 +53,7 @@ namespace mongo {
|
||||
IndexPlugin( const string& name );
|
||||
virtual ~IndexPlugin(){}
|
||||
|
||||
virtual IndexType* generate( const IndexSpec& spec ) const = 0;
|
||||
virtual IndexType* generate( const IndexSpec * spec ) const = 0;
|
||||
|
||||
static IndexPlugin* get( const string& name ){
|
||||
if ( ! _plugins )
|
||||
@ -104,7 +104,9 @@ namespace mongo {
|
||||
|
||||
void getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const;
|
||||
|
||||
private:
|
||||
BSONElement missingField() const { return _nullElt; }
|
||||
|
||||
protected:
|
||||
void _getKeys( vector<const char*> fieldNames , vector<BSONElement> fixed , const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const;
|
||||
|
||||
vector<const char*> _fieldNames;
|
||||
@ -114,9 +116,11 @@ namespace mongo {
|
||||
BSONObj _nullObj;
|
||||
BSONElement _nullElt;
|
||||
|
||||
IndexType * _indexType;
|
||||
shared_ptr<IndexType> _indexType;
|
||||
|
||||
void _init();
|
||||
|
||||
friend class IndexType;
|
||||
};
|
||||
|
||||
/* Details about a particular index. There is one of these effectively for each object in
|
||||
|
Loading…
Reference in New Issue
Block a user