summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/internal_plans.h
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-08-13 17:20:54 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-08-14 22:28:01 -0400
commit3bd462d9e4c30a2002449dd0d17b7d8ca6b0825b (patch)
treeca41888698faf249a4ebe3d6fc4c5fe3aa1da034 /src/mongo/db/query/internal_plans.h
parent35008eaeaebf8245af14f0ea9bbca42b51ed23e2 (diff)
downloadmongo-3bd462d9e4c30a2002449dd0d17b7d8ca6b0825b.tar.gz
SERVER-10026 SERVER-10461 overhaul yielding, introduce findAll
Diffstat (limited to 'src/mongo/db/query/internal_plans.h')
-rw-r--r--src/mongo/db/query/internal_plans.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mongo/db/query/internal_plans.h b/src/mongo/db/query/internal_plans.h
new file mode 100644
index 00000000000..65c7e8c1001
--- /dev/null
+++ b/src/mongo/db/query/internal_plans.h
@@ -0,0 +1,46 @@
+/**
+ * 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/>.
+ */
+
+#include "mongo/db/exec/collection_scan.h"
+#include "mongo/db/query/eof_runner.h"
+#include "mongo/db/query/internal_runner.h"
+
+namespace mongo {
+
+ /**
+ * The internal planner is a one-stop shop for "off-the-shelf" plans. Most internal procedures
+ * that do not require advanced queries could be served by plans already in here.
+ */
+ class InternalPlanner {
+ public:
+ /**
+ * A collection scan. Caller owns pointer.
+ */
+ static Runner* findAll(const StringData& ns, const DiskLoc startLoc = DiskLoc()) {
+ NamespaceDetails* nsd = nsdetails(ns);
+ if (NULL == nsd) { return new EOFRunner(ns.toString()); }
+
+ CollectionScanParams params;
+ params.ns = ns.toString();
+ params.start = startLoc;
+ WorkingSet* ws = new WorkingSet();
+ CollectionScan* cs = new CollectionScan(params, ws, NULL);
+
+ return new InternalRunner(ns.toString(), cs, ws);
+ }
+ };
+
+} // namespace mongo