MongoDB C++ Driver legacy-1.0.6
Loading...
Searching...
No Matches
command_writer.h
1/* Copyright 2014 MongoDB Inc.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#pragma once
17
18#include "mongo/client/dbclient_writer.h"
19
20namespace mongo {
21
22class DBClientBase;
23
25public:
26 explicit CommandWriter(DBClientBase* client);
27
28 virtual void write(const StringData& ns,
29 const std::vector<WriteOperation*>& write_operations,
30 bool ordered,
31 const WriteConcern* writeConcern,
32 WriteResult* writeResult);
33
34private:
35 void _endCommand(BSONArrayBuilder* batch,
37 bool ordered,
38 BSONObjBuilder* command);
39
40 BSONObj _send(BSONObjBuilder* command, const WriteConcern* writeConcern, const StringData& ns);
41
42 bool _fits(BSONArrayBuilder* builder, WriteOperation* operation);
43
44 DBClientBase* const _client;
45};
46
47} // namespace mongo
Definition bsonobjbuilder.h:765
Utility for creating a BSONObj.
Definition bsonobjbuilder.h:53
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary representa...
Definition bsonobj.h:78
Definition command_writer.h:24
abstract class that implements the core db operations
Definition dbclientinterface.h:1467
Definition dbclient_writer.h:27
Class to encapsulate client side "Write Concern" concept.
Definition write_concern.h:35
Represents a single server side write operation and encapsulates the process for encoding the operati...
Definition write_operation.h:31
Class representing the result of a write operations sent to the server.
Definition write_result.h:33
the main MongoDB namespace
Definition bulk_operation_builder.h:24