diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2017-12-19 14:31:36 -0500 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2017-12-19 17:29:29 -0500 |
commit | b5a2cc0fec6ac30b1a0196da5feb41d85a8b76c3 (patch) | |
tree | 4147e3b4ffbfea86eec107e7d6a6d777bded033d /src/mongo/db/pipeline/pipeline_d.h | |
parent | bd9c109958c1721767f5432683706c62ec90fe30 (diff) | |
download | mongo-b5a2cc0fec6ac30b1a0196da5feb41d85a8b76c3.tar.gz |
SERVER-32190 Make MongoProcessInterface always available
Diffstat (limited to 'src/mongo/db/pipeline/pipeline_d.h')
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.h b/src/mongo/db/pipeline/pipeline_d.h index 467aa9a8d1c..1551a9d035f 100644 --- a/src/mongo/db/pipeline/pipeline_d.h +++ b/src/mongo/db/pipeline/pipeline_d.h @@ -32,8 +32,10 @@ #include <memory> #include "mongo/bson/bsonobj.h" +#include "mongo/db/dbdirectclient.h" #include "mongo/db/namespace_string.h" #include "mongo/db/pipeline/aggregation_request.h" +#include "mongo/db/pipeline/mongo_process_interface.h" #include "mongo/db/query/plan_executor.h" namespace mongo { @@ -59,6 +61,75 @@ struct DepsTracker; */ class PipelineD { public: + class MongoDProcessInterface final : public MongoProcessInterface { + public: + MongoDProcessInterface(OperationContext* opCtx); + + void setOperationContext(OperationContext* opCtx) final; + DBClientBase* directClient() final; + bool isSharded(OperationContext* opCtx, const NamespaceString& nss) final; + BSONObj insert(const boost::intrusive_ptr<ExpressionContext>& expCtx, + const NamespaceString& ns, + const std::vector<BSONObj>& objs) final; + CollectionIndexUsageMap getIndexStats(OperationContext* opCtx, + const NamespaceString& ns) final; + void appendLatencyStats(OperationContext* opCtx, + const NamespaceString& nss, + bool includeHistograms, + BSONObjBuilder* builder) const final; + Status appendStorageStats(OperationContext* opCtx, + const NamespaceString& nss, + const BSONObj& param, + BSONObjBuilder* builder) const final; + Status appendRecordCount(OperationContext* opCtx, + const NamespaceString& nss, + BSONObjBuilder* builder) const final; + BSONObj getCollectionOptions(const NamespaceString& nss) final; + Status renameIfOptionsAndIndexesHaveNotChanged( + OperationContext* opCtx, + const BSONObj& renameCommandObj, + const NamespaceString& targetNs, + const BSONObj& originalCollectionOptions, + const std::list<BSONObj>& originalIndexes) final; + StatusWith<std::unique_ptr<Pipeline, PipelineDeleter>> makePipeline( + const std::vector<BSONObj>& rawPipeline, + const boost::intrusive_ptr<ExpressionContext>& expCtx, + const MakePipelineOptions opts = MakePipelineOptions{}) final; + Status attachCursorSourceToPipeline(const boost::intrusive_ptr<ExpressionContext>& expCtx, + Pipeline* pipeline) final; + std::vector<BSONObj> getCurrentOps(OperationContext* opCtx, + CurrentOpConnectionsMode connMode, + CurrentOpUserMode userMode, + CurrentOpTruncateMode truncateMode) const final; + std::string getShardName(OperationContext* opCtx) const final; + std::vector<FieldPath> collectDocumentKeyFields(OperationContext* opCtx, + const NamespaceString& nss, + UUID uuid) const final; + boost::optional<Document> lookupSingleDocument( + const boost::intrusive_ptr<ExpressionContext>& expCtx, + const NamespaceString& nss, + UUID collectionUUID, + const Document& documentKey, + boost::optional<BSONObj> readConcern) final; + std::vector<GenericCursor> getCursors( + const boost::intrusive_ptr<ExpressionContext>& expCtx) const final; + + private: + /** + * Looks up the collection default collator for the collection given by 'collectionUUID'. A + * collection's default collation is not allowed to change, so we cache the result to allow + * for quick lookups in the future. Looks up the collection by UUID, and returns 'nullptr' + * if the collection does not exist or if the collection's default collation is the simple + * collation. + */ + std::unique_ptr<CollatorInterface> _getCollectionDefaultCollator(OperationContext* opCtx, + const NamespaceString& nss, + UUID collectionUUID); + + DBDirectClient _client; + std::map<UUID, std::unique_ptr<const CollatorInterface>> _collatorCache; + }; + /** * If the first stage in the pipeline does not generate its own output documents, attaches a * DocumentSourceCursor to the front of the pipeline which will output documents from the |