summaryrefslogtreecommitdiff
path: root/src/mongo/rpc/reply_builder_interface.h
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2015-07-08 19:23:59 -0400
committerMisha Tyulenev <misha@mongodb.com>2015-07-08 19:26:19 -0400
commit5bd86559ad505c1219bd3f9ad8775b1594669381 (patch)
treed1f810367ca2adaf9916276d07e9f849c63e19c7 /src/mongo/rpc/reply_builder_interface.h
parent1913834c30886d3bebc7a8edbaf7dc1279aa2923 (diff)
downloadmongo-5bd86559ad505c1219bd3f9ad8775b1594669381.tar.gz
SERVER-18930 SERVER-19060 SERVER-19132 SERVER-19133 Implement LegacyReply(Builder) API and up/down conversions
Diffstat (limited to 'src/mongo/rpc/reply_builder_interface.h')
-rw-r--r--src/mongo/rpc/reply_builder_interface.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mongo/rpc/reply_builder_interface.h b/src/mongo/rpc/reply_builder_interface.h
index e97e3e7fe9b..c02511be567 100644
--- a/src/mongo/rpc/reply_builder_interface.h
+++ b/src/mongo/rpc/reply_builder_interface.h
@@ -31,7 +31,7 @@
#include <memory>
#include "mongo/base/disallow_copying.h"
-#include "mongo/base/status_with.h"
+#include "mongo/base/status.h"
#include "mongo/rpc/protocol.h"
namespace mongo {
@@ -59,13 +59,13 @@ public:
virtual ~ReplyBuilderInterface() = default;
- virtual ReplyBuilderInterface& setMetadata(BSONObj metadata) = 0;
+ virtual ReplyBuilderInterface& setMetadata(const BSONObj& metadata) = 0;
/**
* Sets the raw command reply. This should probably not be used in favor of the
* variants that accept a Status or StatusWith.
*/
- virtual ReplyBuilderInterface& setRawCommandReply(BSONObj reply) = 0;
+ virtual ReplyBuilderInterface& setRawCommandReply(const BSONObj& reply) = 0;
/**
* Sets the reply for this command. If an engaged StatusWith<BSONObj> is passed, the command
@@ -85,19 +85,21 @@ public:
* interfacing with legacy code that adds additional data to a failed command reply and
* its use is discouraged in new code.
*/
- ReplyBuilderInterface& setCommandReply(Status nonOKStatus, BSONObj extraErrorInfo);
+ ReplyBuilderInterface& setCommandReply(Status nonOKStatus, const BSONObj& extraErrorInfo);
/**
* Add a range of output documents to the reply. This method can be called multiple times
- * before calling done().
+ * before calling done(). A non OK status indicates that the message does not have
+ * enough space to store ouput documents.
*/
- virtual ReplyBuilderInterface& addOutputDocs(DocumentRange outputDocs) = 0;
+ virtual Status addOutputDocs(DocumentRange outputDocs) = 0;
/**
* Add a single output document to the reply. This method can be called multiple times
- * before calling done().
+ * before calling done(). A non OK status indicates that the message does not have
+ * enough space to store ouput documents.
*/
- virtual ReplyBuilderInterface& addOutputDoc(BSONObj outputDoc) = 0;
+ virtual Status addOutputDoc(const BSONObj& outputDoc) = 0;
/**
* Gets the state of the builder. As the builder will simply crash the process if it is ever
@@ -123,7 +125,7 @@ public:
* Returns available space in bytes, should be used to verify that the message have enough
* space for ouput documents.
*/
- virtual std::size_t availableSpaceForOutputDocs() const = 0;
+ virtual std::size_t availableBytes() const = 0;
/**
* Writes data then transfers ownership of the message to the caller. The behavior of