summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/mongod_process_interface.h
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-07-10 17:08:48 -0400
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-08-08 09:49:15 -0400
commit2e69710b5bf058dae6d04ada3cb003cbf872c3a8 (patch)
tree0376fba9838b464855f78be055e6be1b67e7bf16 /src/mongo/db/pipeline/mongod_process_interface.h
parentcaa085deb9a7ebe3b3dcd8804d47117b73c9fb0b (diff)
downloadmongo-2e69710b5bf058dae6d04ada3cb003cbf872c3a8.tar.gz
SERVER-35895: Add ability for $out to write to remote hosts
Diffstat (limited to 'src/mongo/db/pipeline/mongod_process_interface.h')
-rw-r--r--src/mongo/db/pipeline/mongod_process_interface.h52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/mongo/db/pipeline/mongod_process_interface.h b/src/mongo/db/pipeline/mongod_process_interface.h
index 2b9ab8d8f19..8d452e54e62 100644
--- a/src/mongo/db/pipeline/mongod_process_interface.h
+++ b/src/mongo/db/pipeline/mongod_process_interface.h
@@ -38,23 +38,26 @@ namespace mongo {
* Class to provide access to mongod-specific implementations of methods required by some
* document sources.
*/
-class MongoDInterface final : public MongoProcessCommon {
+class MongoDInterface : public MongoProcessCommon {
public:
+ static std::shared_ptr<MongoProcessInterface> create(OperationContext* opCtx);
+
MongoDInterface(OperationContext* opCtx);
+ virtual ~MongoDInterface() = default;
+
void setOperationContext(OperationContext* opCtx) final;
DBClientBase* directClient() final;
bool isSharded(OperationContext* opCtx, const NamespaceString& nss) final;
- void insert(const boost::intrusive_ptr<ExpressionContext>& expCtx,
- const NamespaceString& ns,
- const std::vector<BSONObj>& objs) final;
- void update(const boost::intrusive_ptr<ExpressionContext>& expCtx,
- const NamespaceString& ns,
- const std::vector<BSONObj>& queries,
- const std::vector<BSONObj>& updates,
- bool upsert,
- bool multi) final;
-
+ virtual void insert(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ const NamespaceString& ns,
+ const std::vector<BSONObj>& objs);
+ virtual void update(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ const NamespaceString& ns,
+ const std::vector<BSONObj>& queries,
+ const std::vector<BSONObj>& updates,
+ bool upsert,
+ bool multi);
CollectionIndexUsageMap getIndexStats(OperationContext* opCtx, const NamespaceString& ns) final;
void appendLatencyStats(OperationContext* opCtx,
const NamespaceString& nss,
@@ -116,4 +119,31 @@ private:
std::map<UUID, std::unique_ptr<const CollatorInterface>> _collatorCache;
};
+/**
+ * Specialized version of the MongoDInterface when this node is a shard server.
+ */
+class MongoDInterfaceShardServer final : public MongoDInterface {
+public:
+ using MongoDInterface::MongoDInterface;
+
+ /**
+ * Inserts the documents 'objs' into the namespace 'ns' using the ClusterWriter for locking,
+ * routing, stale config handling, etc.
+ */
+ void insert(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ const NamespaceString& ns,
+ const std::vector<BSONObj>& objs) final;
+
+ /**
+ * Replaces the documents matching 'queries' with 'updates' using the ClusterWriter for locking,
+ * routing, stale config handling, etc.
+ */
+ void update(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ const NamespaceString& ns,
+ const std::vector<BSONObj>& queries,
+ const std::vector<BSONObj>& updates,
+ bool upsert,
+ bool multi) final;
+};
+
} // namespace mongo