MongoDB C++ Driver  legacy-1.1.2
wire_protocol_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 
20 namespace mongo {
21 
22 class DBClientBase;
23 
25 public:
26  explicit WireProtocolWriter(DBClientBase* client);
27 
28  virtual void write(const StringData& ns,
29  const std::vector<WriteOperation*>& write_operations,
30  bool ordered,
31  bool bypassDocumentValidation,
32  const WriteConcern* writeConcern,
33  WriteResult* writeResult);
34 
35 private:
36  BSONObj _send(WriteOpType opCode,
37  const BufBuilder& builder,
38  const WriteConcern* wc,
39  const StringData& ns);
40 
41  bool _batchableRequest(WriteOpType opCode, const WriteResult* const writeResult);
42  bool _fits(BufBuilder* builder, WriteOperation* operation);
43 
44  DBClientBase* const _client;
45 };
46 
47 } // namespace mongo
Represents a single server side write operation and encapsulates the process for encoding the operati...
Definition: write_operation.h:31
A StringData object wraps a 'const string&' or a 'const char*' without copying its contents...
Definition: string_data.h:43
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
Class representing the result of a write operations sent to the server.
Definition: write_result.h:33
Class to encapsulate client side "Write Concern" concept.
Definition: write_concern.h:35
Definition: wire_protocol_writer.h:24
Definition: dbclient_writer.h:27
abstract class that implements the core db operations
Definition: dbclientinterface.h:1422
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary represent...
Definition: bsonobj.h:78