diff options
author | Jason Rassi <rassi@10gen.com> | 2015-08-28 01:59:12 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-08-28 12:52:28 -0400 |
commit | 66028bde22d641a1fbf96e7e3f76554e059cc221 (patch) | |
tree | 393f4caf65643ea416858152a34396c5696ff3b6 /src/mongo/db/query | |
parent | 622dae556361380471b4ce0ef4e761e2342a6adb (diff) | |
download | mongo-66028bde22d641a1fbf96e7e3f76554e059cc221.tar.gz |
SERVER-19569 Combine getmore_response.h with cursor_responses.h
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/SConscript | 5 | ||||
-rw-r--r-- | src/mongo/db/query/cursor_response.cpp (renamed from src/mongo/db/query/getmore_response.cpp) | 46 | ||||
-rw-r--r-- | src/mongo/db/query/cursor_response.h (renamed from src/mongo/db/query/cursor_responses.h) | 45 | ||||
-rw-r--r-- | src/mongo/db/query/cursor_response_test.cpp (renamed from src/mongo/db/query/getmore_response_test.cpp) | 90 | ||||
-rw-r--r-- | src/mongo/db/query/cursor_responses.cpp | 59 | ||||
-rw-r--r-- | src/mongo/db/query/getmore_response.h | 66 |
6 files changed, 118 insertions, 193 deletions
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript index cc543afead5..dfcb8f9265c 100644 --- a/src/mongo/db/query/SConscript +++ b/src/mongo/db/query/SConscript @@ -113,10 +113,9 @@ env.Library( target='command_request_response', source=[ 'count_request.cpp', - 'cursor_responses.cpp', + 'cursor_response.cpp', 'find_and_modify_request.cpp', 'getmore_request.cpp', - 'getmore_response.cpp', 'killcursors_request.cpp', 'killcursors_response.cpp', ], @@ -132,9 +131,9 @@ env.CppUnitTest( target='command_request_response_test', source=[ 'count_request_test.cpp', + 'cursor_response_test.cpp', 'find_and_modify_request_test.cpp', 'getmore_request_test.cpp', - 'getmore_response_test.cpp', 'killcursors_request_test.cpp', 'killcursors_response_test.cpp', ], diff --git a/src/mongo/db/query/getmore_response.cpp b/src/mongo/db/query/cursor_response.cpp index ce64c7a717a..85afd949b1d 100644 --- a/src/mongo/db/query/getmore_response.cpp +++ b/src/mongo/db/query/cursor_response.cpp @@ -30,7 +30,7 @@ #include "mongo/platform/basic.h" -#include "mongo/db/query/getmore_response.h" +#include "mongo/db/query/cursor_response.h" #include "mongo/bson/bsontypes.h" #include "mongo/rpc/get_status_from_command_result.h" @@ -43,20 +43,42 @@ const char kCursorField[] = "cursor"; const char kIdField[] = "id"; const char kNsField[] = "ns"; const char kBatchField[] = "nextBatch"; -const char kBatchFieldAlt[] = "firstBatch"; +const char kBatchFieldInitial[] = "firstBatch"; } // namespace -GetMoreResponse::GetMoreResponse(NamespaceString namespaceString, - CursorId id, - std::vector<BSONObj> objs, - boost::optional<long long> nReturnedSoFar) +void appendCursorResponseObject(long long cursorId, + StringData cursorNamespace, + BSONArray firstBatch, + BSONObjBuilder* builder) { + BSONObjBuilder cursorObj(builder->subobjStart(kCursorField)); + cursorObj.append(kIdField, cursorId); + cursorObj.append(kNsField, cursorNamespace); + cursorObj.append(kBatchFieldInitial, firstBatch); + cursorObj.done(); +} + +void appendGetMoreResponseObject(long long cursorId, + StringData cursorNamespace, + BSONArray nextBatch, + BSONObjBuilder* builder) { + BSONObjBuilder cursorObj(builder->subobjStart(kCursorField)); + cursorObj.append(kIdField, cursorId); + cursorObj.append(kNsField, cursorNamespace); + cursorObj.append(kBatchField, nextBatch); + cursorObj.done(); +} + +CursorResponse::CursorResponse(NamespaceString namespaceString, + CursorId id, + std::vector<BSONObj> objs, + boost::optional<long long> nReturnedSoFar) : nss(std::move(namespaceString)), cursorId(id), batch(std::move(objs)), numReturnedSoFar(nReturnedSoFar) {} -StatusWith<GetMoreResponse> GetMoreResponse::parseFromBSON(const BSONObj& cmdResponse) { +StatusWith<CursorResponse> CursorResponse::parseFromBSON(const BSONObj& cmdResponse) { Status cmdStatus = getStatusFromCommandResult(cmdResponse); if (!cmdStatus.isOK()) { return cmdStatus; @@ -92,12 +114,12 @@ StatusWith<GetMoreResponse> GetMoreResponse::parseFromBSON(const BSONObj& cmdRes BSONElement batchElt = cursorObj[kBatchField]; if (batchElt.eoo()) { - batchElt = cursorObj[kBatchFieldAlt]; + batchElt = cursorObj[kBatchFieldInitial]; } if (batchElt.type() != BSONType::Array) { return {ErrorCodes::TypeMismatch, - str::stream() << "Must have array field '" << kBatchFieldAlt << "' or '" + str::stream() << "Must have array field '" << kBatchFieldInitial << "' or '" << kBatchField << "' in: " << cmdResponse}; } batchObj = batchElt.Obj(); @@ -116,7 +138,7 @@ StatusWith<GetMoreResponse> GetMoreResponse::parseFromBSON(const BSONObj& cmdRes return {{NamespaceString(fullns), cursorId, batch}}; } -void GetMoreResponse::toBSON(BSONObjBuilder* builder) const { +void CursorResponse::addToBSON(BSONObjBuilder* builder) const { BSONObjBuilder cursorBuilder(builder->subobjStart(kCursorField)); cursorBuilder.append(kIdField, cursorId); @@ -133,9 +155,9 @@ void GetMoreResponse::toBSON(BSONObjBuilder* builder) const { builder->append("ok", 1.0); } -BSONObj GetMoreResponse::toBSON() const { +BSONObj CursorResponse::toBSON() const { BSONObjBuilder builder; - toBSON(&builder); + addToBSON(&builder); return builder.obj(); } diff --git a/src/mongo/db/query/cursor_responses.h b/src/mongo/db/query/cursor_response.h index 06f2f268e63..e606dcd1559 100644 --- a/src/mongo/db/query/cursor_responses.h +++ b/src/mongo/db/query/cursor_response.h @@ -28,20 +28,23 @@ #pragma once -namespace mongo { +#include <vector> + +#include "mongo/base/status_with.h" +#include "mongo/bson/bsonobj.h" +#include "mongo/db/clientcursor.h" +#include "mongo/db/namespace_string.h" -class BSONObjBuilder; -class StringData; -struct BSONArray; +namespace mongo { /** * Builds a cursor response object from the provided cursor identifiers and "firstBatch", * and appends the response object to the provided builder under the field name "cursor". - * If the node is a member of a replSet, also appends the current term, primary, and - * lastOp information. * * The response object has the following format: * { id: <NumberLong>, ns: <String>, firstBatch: <Array> }. + * + * This function is deprecated. Prefer CursorResponse::toBSON() instead. */ void appendCursorResponseObject(long long cursorId, StringData cursorNamespace, @@ -51,15 +54,41 @@ void appendCursorResponseObject(long long cursorId, /** * Builds a getMore response object from the provided cursor identifiers and "nextBatch", * and appends the response object to the provided builder under the field name "cursor". - * If the node is a member of a replSet, also appends the current term, primary, and - * lastOp information. * * The response object has the following format: * { id: <NumberLong>, ns: <String>, nextBatch: <Array> }. + * + * This function is deprecated. Prefer CursorResponse::toBSON() instead. */ void appendGetMoreResponseObject(long long cursorId, StringData cursorNamespace, BSONArray nextBatch, BSONObjBuilder* builder); +struct CursorResponse { + /** + * Constructs from values for each of the fields. + */ + CursorResponse(NamespaceString namspaceString, + CursorId id, + std::vector<BSONObj> objs, + boost::optional<long long> nReturnedSoFar = boost::none); + + /** + * Constructs a CursorResponse from the command BSON response. + */ + static StatusWith<CursorResponse> parseFromBSON(const BSONObj& cmdResponse); + + /** + * Converts this response to its raw BSON representation. + */ + BSONObj toBSON() const; + void addToBSON(BSONObjBuilder* builder) const; + + const NamespaceString nss; + const CursorId cursorId; + const std::vector<BSONObj> batch; + const boost::optional<long long> numReturnedSoFar; +}; + } // namespace mongo diff --git a/src/mongo/db/query/getmore_response_test.cpp b/src/mongo/db/query/cursor_response_test.cpp index 3c9db3dba6b..37f426d8eb9 100644 --- a/src/mongo/db/query/getmore_response_test.cpp +++ b/src/mongo/db/query/cursor_response_test.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/db/query/getmore_response.h" +#include "mongo/db/query/cursor_response.h" #include "mongo/unittest/unittest.h" @@ -36,15 +36,15 @@ namespace mongo { namespace { -TEST(GetMoreResponseTest, parseFromBSONFirstBatch) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONFirstBatch) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "firstBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) << "ok" << 1)); ASSERT_OK(result.getStatus()); - GetMoreResponse response = result.getValue(); + CursorResponse response = result.getValue(); ASSERT_EQ(response.cursorId, CursorId(123)); ASSERT_EQ(response.nss.ns(), "db.coll"); ASSERT_EQ(response.batch.size(), 2U); @@ -52,15 +52,15 @@ TEST(GetMoreResponseTest, parseFromBSONFirstBatch) { ASSERT_EQ(response.batch[1], BSON("_id" << 2)); } -TEST(GetMoreResponseTest, parseFromBSONNextBatch) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONNextBatch) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "nextBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) << "ok" << 1)); ASSERT_OK(result.getStatus()); - GetMoreResponse response = result.getValue(); + CursorResponse response = result.getValue(); ASSERT_EQ(response.cursorId, CursorId(123)); ASSERT_EQ(response.nss.ns(), "db.coll"); ASSERT_EQ(response.batch.size(), 2U); @@ -68,15 +68,15 @@ TEST(GetMoreResponseTest, parseFromBSONNextBatch) { ASSERT_EQ(response.batch[1], BSON("_id" << 2)); } -TEST(GetMoreResponseTest, parseFromBSONCursorIdZero) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONCursorIdZero) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(0) << "ns" << "db.coll" << "nextBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) << "ok" << 1)); ASSERT_OK(result.getStatus()); - GetMoreResponse response = result.getValue(); + CursorResponse response = result.getValue(); ASSERT_EQ(response.cursorId, CursorId(0)); ASSERT_EQ(response.nss.ns(), "db.coll"); ASSERT_EQ(response.batch.size(), 2U); @@ -84,46 +84,46 @@ TEST(GetMoreResponseTest, parseFromBSONCursorIdZero) { ASSERT_EQ(response.batch[1], BSON("_id" << 2)); } -TEST(GetMoreResponseTest, parseFromBSONEmptyBatch) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON( +TEST(CursorResponseTest, parseFromBSONEmptyBatch) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON( BSON("cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "nextBatch" << BSONArrayBuilder().arr()) << "ok" << 1)); ASSERT_OK(result.getStatus()); - GetMoreResponse response = result.getValue(); + CursorResponse response = result.getValue(); ASSERT_EQ(response.cursorId, CursorId(123)); ASSERT_EQ(response.nss.ns(), "db.coll"); ASSERT_EQ(response.batch.size(), 0U); } -TEST(GetMoreResponseTest, parseFromBSONMissingCursorField) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON("ok" << 1)); +TEST(CursorResponseTest, parseFromBSONMissingCursorField) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON("ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONCursorFieldWrongType) { - StatusWith<GetMoreResponse> result = - GetMoreResponse::parseFromBSON(BSON("cursor" << 3 << "ok" << 1)); +TEST(CursorResponseTest, parseFromBSONCursorFieldWrongType) { + StatusWith<CursorResponse> result = + CursorResponse::parseFromBSON(BSON("cursor" << 3 << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONNsFieldMissing) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONNsFieldMissing) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(123) << "firstBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONNsFieldWrongType) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONNsFieldWrongType) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(123) << "ns" << 456 << "firstBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONIdFieldMissing) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON( +TEST(CursorResponseTest, parseFromBSONIdFieldMissing) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON( BSON("cursor" << BSON("ns" << "db.coll" << "nextBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))) @@ -131,8 +131,8 @@ TEST(GetMoreResponseTest, parseFromBSONIdFieldMissing) { ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONIdFieldWrongType) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON( +TEST(CursorResponseTest, parseFromBSONIdFieldWrongType) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON( BSON("cursor" << BSON("id" << "123" << "ns" @@ -142,49 +142,49 @@ TEST(GetMoreResponseTest, parseFromBSONIdFieldWrongType) { ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONBatchFieldMissing) { - StatusWith<GetMoreResponse> result = - GetMoreResponse::parseFromBSON(BSON("cursor" << BSON("id" << CursorId(123) << "ns" - << "db.coll") << "ok" << 1)); +TEST(CursorResponseTest, parseFromBSONBatchFieldMissing) { + StatusWith<CursorResponse> result = + CursorResponse::parseFromBSON(BSON("cursor" << BSON("id" << CursorId(123) << "ns" + << "db.coll") << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONFirstBatchFieldWrongType) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON( +TEST(CursorResponseTest, parseFromBSONFirstBatchFieldWrongType) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON( BSON("cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "firstBatch" << BSON("_id" << 1)) << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONNextBatchFieldWrongType) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON( +TEST(CursorResponseTest, parseFromBSONNextBatchFieldWrongType) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON( BSON("cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "nextBatch" << BSON("_id" << 1)) << "ok" << 1)); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONOkFieldMissing) { - StatusWith<GetMoreResponse> result = GetMoreResponse::parseFromBSON(BSON( +TEST(CursorResponseTest, parseFromBSONOkFieldMissing) { + StatusWith<CursorResponse> result = CursorResponse::parseFromBSON(BSON( "cursor" << BSON("id" << CursorId(123) << "ns" << "db.coll" << "nextBatch" << BSON_ARRAY(BSON("_id" << 1) << BSON("_id" << 2))))); ASSERT_NOT_OK(result.getStatus()); } -TEST(GetMoreResponseTest, parseFromBSONHandleErrorResponse) { - StatusWith<GetMoreResponse> result = - GetMoreResponse::parseFromBSON(BSON("ok" << 0 << "code" << 123 << "errmsg" - << "does not work")); +TEST(CursorResponseTest, parseFromBSONHandleErrorResponse) { + StatusWith<CursorResponse> result = + CursorResponse::parseFromBSON(BSON("ok" << 0 << "code" << 123 << "errmsg" + << "does not work")); ASSERT_NOT_OK(result.getStatus()); ASSERT_EQ(result.getStatus().code(), 123); ASSERT_EQ(result.getStatus().reason(), "does not work"); } -TEST(GetMoreResponseTest, toBSON) { +TEST(CursorResponseTest, toBSON) { std::vector<BSONObj> batch = {BSON("_id" << 1), BSON("_id" << 2)}; - GetMoreResponse response(NamespaceString("testdb.testcoll"), CursorId(123), batch); + CursorResponse response(NamespaceString("testdb.testcoll"), CursorId(123), batch); BSONObj responseObj = response.toBSON(); BSONObj expectedResponse = BSON( "cursor" << BSON("id" << CursorId(123) << "ns" @@ -194,12 +194,12 @@ TEST(GetMoreResponseTest, toBSON) { ASSERT_EQ(responseObj, expectedResponse); } -TEST(GetMoreResponseTest, toBSONWithBuilder) { +TEST(CursorResponseTest, addToBSON) { std::vector<BSONObj> batch = {BSON("_id" << 1), BSON("_id" << 2)}; - GetMoreResponse response(NamespaceString("testdb.testcoll"), CursorId(123), batch); + CursorResponse response(NamespaceString("testdb.testcoll"), CursorId(123), batch); BSONObjBuilder builder; - response.toBSON(&builder); + response.addToBSON(&builder); BSONObj responseObj = builder.obj(); BSONObj expectedResponse = BSON( diff --git a/src/mongo/db/query/cursor_responses.cpp b/src/mongo/db/query/cursor_responses.cpp deleted file mode 100644 index 9165c498e37..00000000000 --- a/src/mongo/db/query/cursor_responses.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2015 MongoDB 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/>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the GNU Affero General Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/db/query/cursor_responses.h" - -#include "mongo/db/jsobj.h" - -namespace mongo { - -void appendCursorResponseObject(long long cursorId, - StringData cursorNamespace, - BSONArray firstBatch, - BSONObjBuilder* builder) { - BSONObjBuilder cursorObj(builder->subobjStart("cursor")); - cursorObj.append("id", cursorId); - cursorObj.append("ns", cursorNamespace); - cursorObj.append("firstBatch", firstBatch); - cursorObj.done(); -} - -void appendGetMoreResponseObject(long long cursorId, - StringData cursorNamespace, - BSONArray nextBatch, - BSONObjBuilder* builder) { - BSONObjBuilder cursorObj(builder->subobjStart("cursor")); - cursorObj.append("id", cursorId); - cursorObj.append("ns", cursorNamespace); - cursorObj.append("nextBatch", nextBatch); - cursorObj.done(); -} - -} // namespace mongo diff --git a/src/mongo/db/query/getmore_response.h b/src/mongo/db/query/getmore_response.h deleted file mode 100644 index 9164c5ebbc9..00000000000 --- a/src/mongo/db/query/getmore_response.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (C) 2015 MongoDB 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/>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the GNU Affero General Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include <vector> - -#include "mongo/base/status_with.h" -#include "mongo/bson/bsonobj.h" -#include "mongo/db/clientcursor.h" -#include "mongo/db/namespace_string.h" - -namespace mongo { - -struct GetMoreResponse { - /** - * Constructs from values for each of the fields. - */ - GetMoreResponse(NamespaceString namspaceString, - CursorId id, - std::vector<BSONObj> objs, - boost::optional<long long> nReturnedSoFar = boost::none); - - /** - * Constructs a GetMoreResponse from the command BSON response. - */ - static StatusWith<GetMoreResponse> parseFromBSON(const BSONObj& cmdResponse); - - /** - * Converts this response to its raw BSON representation. - */ - BSONObj toBSON() const; - void toBSON(BSONObjBuilder* builder) const; - - const NamespaceString nss; - const CursorId cursorId; - const std::vector<BSONObj> batch; - const boost::optional<long long> numReturnedSoFar; -}; - -} // namespace mongo |