summaryrefslogtreecommitdiff
path: root/src/mongo/db/index
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-02-03 14:12:49 -0500
committerMathias Stearn <mathias@10gen.com>2015-02-13 15:29:33 -0500
commit4577311195bfab391d05c7e1862e0653771295e5 (patch)
treecb6289b180643d20c3dee39357142936ab610b24 /src/mongo/db/index
parent2d359dfdd24629681742611f6120ffb504ac718f (diff)
downloadmongo-4577311195bfab391d05c7e1862e0653771295e5.tar.gz
SERVER-17062 Move getKeys() up to IndexAccessMethod and make const
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r--src/mongo/db/index/2d_access_method.cpp2
-rw-r--r--src/mongo/db/index/2d_access_method.h2
-rw-r--r--src/mongo/db/index/btree_access_method.cpp2
-rw-r--r--src/mongo/db/index/btree_access_method.h2
-rw-r--r--src/mongo/db/index/btree_based_access_method.h3
-rw-r--r--src/mongo/db/index/btree_based_bulk_access_method.h4
-rw-r--r--src/mongo/db/index/fts_access_method.cpp2
-rw-r--r--src/mongo/db/index/fts_access_method.h2
-rw-r--r--src/mongo/db/index/hash_access_method.cpp2
-rw-r--r--src/mongo/db/index/hash_access_method.h2
-rw-r--r--src/mongo/db/index/haystack_access_method.cpp2
-rw-r--r--src/mongo/db/index/haystack_access_method.h2
-rw-r--r--src/mongo/db/index/index_access_method.h5
-rw-r--r--src/mongo/db/index/s2_access_method.cpp2
-rw-r--r--src/mongo/db/index/s2_access_method.h2
15 files changed, 21 insertions, 15 deletions
diff --git a/src/mongo/db/index/2d_access_method.cpp b/src/mongo/db/index/2d_access_method.cpp
index a4df454ab20..0e9e5265ee0 100644
--- a/src/mongo/db/index/2d_access_method.cpp
+++ b/src/mongo/db/index/2d_access_method.cpp
@@ -49,7 +49,7 @@ namespace mongo {
}
/** Finds the key objects to put in an index */
- void TwoDAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void TwoDAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
ExpressionKeysPrivate::get2DKeys(obj, _params, keys, NULL);
}
diff --git a/src/mongo/db/index/2d_access_method.h b/src/mongo/db/index/2d_access_method.h
index eec59cbc6a3..21cbdf2947d 100644
--- a/src/mongo/db/index/2d_access_method.h
+++ b/src/mongo/db/index/2d_access_method.h
@@ -56,7 +56,7 @@ namespace mongo {
// This really gets the 'locs' from the provided obj.
void getKeys(const BSONObj& obj, std::vector<BSONObj>& locs) const;
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
TwoDIndexingParams _params;
};
diff --git a/src/mongo/db/index/btree_access_method.cpp b/src/mongo/db/index/btree_access_method.cpp
index dcd40fe386c..b3823c64ce1 100644
--- a/src/mongo/db/index/btree_access_method.cpp
+++ b/src/mongo/db/index/btree_access_method.cpp
@@ -65,7 +65,7 @@ namespace mongo {
}
}
- void BtreeAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void BtreeAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
_keyGenerator->getKeys(obj, keys);
}
diff --git a/src/mongo/db/index/btree_access_method.h b/src/mongo/db/index/btree_access_method.h
index bb866694414..3ccc2fe11d2 100644
--- a/src/mongo/db/index/btree_access_method.h
+++ b/src/mongo/db/index/btree_access_method.h
@@ -56,7 +56,7 @@ namespace mongo {
virtual ~BtreeAccessMethod() { }
private:
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
// Our keys differ for V0 and V1.
boost::scoped_ptr<BtreeKeyGenerator> _keyGenerator;
diff --git a/src/mongo/db/index/btree_based_access_method.h b/src/mongo/db/index/btree_based_access_method.h
index d49d092f0f7..4b8c5f27b26 100644
--- a/src/mongo/db/index/btree_based_access_method.h
+++ b/src/mongo/db/index/btree_based_access_method.h
@@ -113,14 +113,11 @@ namespace mongo {
virtual RecordId findSingle( OperationContext* txn, const BSONObj& key ) const;
protected:
- // Friends who need getKeys.
friend class BtreeBasedBulkAccessMethod;
// See below for body.
class BtreeBasedPrivateUpdateData;
- virtual void getKeys(const BSONObj &obj, BSONObjSet *keys) = 0;
-
// Determines whether it's OK to ignore ErrorCodes::KeyTooLong for this OperationContext
bool ignoreKeyTooLong(OperationContext* txn);
diff --git a/src/mongo/db/index/btree_based_bulk_access_method.h b/src/mongo/db/index/btree_based_bulk_access_method.h
index f683ec51aff..65a5715b353 100644
--- a/src/mongo/db/index/btree_based_bulk_access_method.h
+++ b/src/mongo/db/index/btree_based_bulk_access_method.h
@@ -137,6 +137,10 @@ namespace mongo {
OperationContext* getOperationContext() { return _txn; }
+ virtual void getKeys(const BSONObj &obj, BSONObjSet *keys) const {
+ _real->getKeys(obj, keys);
+ }
+
private:
typedef Sorter<BSONObj, RecordId> BSONObjExternalSorter;
diff --git a/src/mongo/db/index/fts_access_method.cpp b/src/mongo/db/index/fts_access_method.cpp
index 4b8321e985c..cb136a1a5e7 100644
--- a/src/mongo/db/index/fts_access_method.cpp
+++ b/src/mongo/db/index/fts_access_method.cpp
@@ -34,7 +34,7 @@ namespace mongo {
FTSAccessMethod::FTSAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree )
: BtreeBasedAccessMethod(btreeState, btree), _ftsSpec(btreeState->descriptor()->infoObj()) { }
- void FTSAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void FTSAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
ExpressionKeysPrivate::getFTSKeys(obj, _ftsSpec, keys);
}
diff --git a/src/mongo/db/index/fts_access_method.h b/src/mongo/db/index/fts_access_method.h
index 8ca7a26afea..d538301b545 100644
--- a/src/mongo/db/index/fts_access_method.h
+++ b/src/mongo/db/index/fts_access_method.h
@@ -45,7 +45,7 @@ namespace mongo {
private:
// Implemented:
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
fts::FTSSpec _ftsSpec;
};
diff --git a/src/mongo/db/index/hash_access_method.cpp b/src/mongo/db/index/hash_access_method.cpp
index 175196d4570..9fb7347e72b 100644
--- a/src/mongo/db/index/hash_access_method.cpp
+++ b/src/mongo/db/index/hash_access_method.cpp
@@ -51,7 +51,7 @@ namespace mongo {
&_hashedField);
}
- void HashAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void HashAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
ExpressionKeysPrivate::getHashKeys(obj, _hashedField, _seed, _hashVersion, _descriptor->isSparse(), keys);
}
diff --git a/src/mongo/db/index/hash_access_method.h b/src/mongo/db/index/hash_access_method.h
index 9b93574249e..fee946046b5 100644
--- a/src/mongo/db/index/hash_access_method.h
+++ b/src/mongo/db/index/hash_access_method.h
@@ -49,7 +49,7 @@ namespace mongo {
virtual ~HashAccessMethod() { }
private:
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
// Only one of our fields is hashed. This is the field name for it.
std::string _hashedField;
diff --git a/src/mongo/db/index/haystack_access_method.cpp b/src/mongo/db/index/haystack_access_method.cpp
index 826bbc082fb..b4b337a6d74 100644
--- a/src/mongo/db/index/haystack_access_method.cpp
+++ b/src/mongo/db/index/haystack_access_method.cpp
@@ -61,7 +61,7 @@ namespace mongo {
uassert(16774, "no non-geo fields specified", _otherFields.size());
}
- void HaystackAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void HaystackAccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
ExpressionKeysPrivate::getHaystackKeys(obj, _geoField, _otherFields, _bucketSize, keys);
}
diff --git a/src/mongo/db/index/haystack_access_method.h b/src/mongo/db/index/haystack_access_method.h
index 1d2820b3ff5..63b3548084e 100644
--- a/src/mongo/db/index/haystack_access_method.h
+++ b/src/mongo/db/index/haystack_access_method.h
@@ -68,7 +68,7 @@ namespace mongo {
BSONObjBuilder* result, unsigned limit);
private:
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
std::string _geoField;
std::vector<std::string> _otherFields;
diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h
index 6178de482f9..c1a87682d54 100644
--- a/src/mongo/db/index/index_access_method.h
+++ b/src/mongo/db/index/index_access_method.h
@@ -209,6 +209,11 @@ namespace mongo {
bool mayInterrupt,
bool dupsAllowed,
std::set<RecordId>* dups ) = 0;
+
+ /**
+ * Fills 'keys' with the keys that should be generated for 'obj' on this index.
+ */
+ virtual void getKeys(const BSONObj &obj, BSONObjSet *keys) const = 0;
};
/**
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index 2c3aad34011..13f2ccee0fe 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -103,7 +103,7 @@ namespace mongo {
return specObj;
}
- void S2AccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) {
+ void S2AccessMethod::getKeys(const BSONObj& obj, BSONObjSet* keys) const {
ExpressionKeysPrivate::getS2Keys(obj, _descriptor->keyPattern(), _params, keys);
}
diff --git a/src/mongo/db/index/s2_access_method.h b/src/mongo/db/index/s2_access_method.h
index 47b74823342..6954d8a4939 100644
--- a/src/mongo/db/index/s2_access_method.h
+++ b/src/mongo/db/index/s2_access_method.h
@@ -55,7 +55,7 @@ namespace mongo {
static BSONObj fixSpec(const BSONObj& specObj);
private:
- virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
+ virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const;
S2IndexingParams _params;
};