diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-04-08 22:45:05 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-04-10 12:41:42 -0400 |
commit | 4f1a1a3a825701f01ba62207858646a7df40843b (patch) | |
tree | a8119a4eaaffcff258d6d9962d63c12024ddfdcd /src/mongo/db/index/s2_access_method.h | |
parent | 37c08671b653c16fc2e1e568a18b380d09a93733 (diff) | |
download | mongo-4f1a1a3a825701f01ba62207858646a7df40843b.tar.gz |
migrate 2dsphere index to new interface SERVER-8791 SERVER-9164
Diffstat (limited to 'src/mongo/db/index/s2_access_method.h')
-rw-r--r-- | src/mongo/db/index/s2_access_method.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mongo/db/index/s2_access_method.h b/src/mongo/db/index/s2_access_method.h new file mode 100644 index 00000000000..697a130cb34 --- /dev/null +++ b/src/mongo/db/index/s2_access_method.h @@ -0,0 +1,53 @@ +/** +* Copyright (C) 2013 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 "mongo/base/status.h" +#include "mongo/db/index/btree_access_method_internal.h" +#include "mongo/db/index/index_descriptor.h" +#include "mongo/db/index/s2_common.h" +#include "mongo/db/jsobj.h" + +namespace mongo { + + class IndexCursor; + class S2IndexingParams; + + class S2AccessMethod : public BtreeBasedAccessMethod { + public: + using BtreeBasedAccessMethod::_descriptor; + using BtreeBasedAccessMethod::_interface; + using BtreeBasedAccessMethod::_ordering; + + S2AccessMethod(IndexDescriptor* descriptor); + virtual ~S2AccessMethod() { } + + virtual Status newCursor(IndexCursor** out); + + private: + virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); + + // getKeys calls the helper methods below. + void getGeoKeys(const BSONElementSet& elements, BSONObjSet* out) const; + void getLiteralKeys(const BSONElementSet& elements, BSONObjSet* out) const; + void getLiteralKeysArray(const BSONObj& obj, BSONObjSet* out) const; + void getOneLiteralKey(const BSONElement& elt, BSONObjSet *out) const; + + S2IndexingParams _params; + }; + +} // namespace mongo |