diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-03-29 10:18:37 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-04-02 11:16:13 -0400 |
commit | bc994d83b810cf39084379c398abcc8c304837bc (patch) | |
tree | 45f6da9a24637dc941525c1cf729cdfe0ed91ae9 /src/mongo/db/index/btree_access_method.h | |
parent | 3ab70d9ed498fc2e879058a8d398f0078388f203 (diff) | |
download | mongo-bc994d83b810cf39084379c398abcc8c304837bc.tar.gz |
btree access method, cursor. migrate btreecursor to use it. SERVER-9163 SERVER-8791
Diffstat (limited to 'src/mongo/db/index/btree_access_method.h')
-rw-r--r-- | src/mongo/db/index/btree_access_method.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/mongo/db/index/btree_access_method.h b/src/mongo/db/index/btree_access_method.h new file mode 100644 index 00000000000..96f67e71e59 --- /dev/null +++ b/src/mongo/db/index/btree_access_method.h @@ -0,0 +1,52 @@ +/** +* 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 <boost/scoped_ptr.hpp> + +#include "mongo/base/status.h" +#include "mongo/db/btree.h" +#include "mongo/db/index/index_access_method.h" +#include "mongo/db/index/btree_key_generator.h" +#include "mongo/db/index/btree_access_method_internal.h" +#include "mongo/db/jsobj.h" + +namespace mongo { + + class IndexCursor; + class IndexDescriptor; + + template <class Key> class BtreeAccessMethod : public BtreeBasedAccessMethod<Key> { + public: + using BtreeBasedAccessMethod<Key>::_descriptor; + using BtreeBasedAccessMethod<Key>::_ordering; + + BtreeAccessMethod(IndexDescriptor* descriptor); + virtual ~BtreeAccessMethod() { } + + virtual Status newCursor(IndexCursor** out); + + // TODO(hk): Keep bucket deletion internal to this class. + + private: + virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); + + // Our keys differ for V0 and V1. + scoped_ptr<BtreeKeyGenerator> _keyGenerator; + }; + +} // namespace mongo |