MongoDB C++ Driver  mongocxx-3.10.2
bucket.hpp
1 // Copyright 2017 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 #pragma once
16 
17 #include <string>
18 
19 #include <mongocxx/options/gridfs/bucket-fwd.hpp>
20 
21 #include <bsoncxx/stdx/optional.hpp>
22 #include <mongocxx/read_concern.hpp>
23 #include <mongocxx/read_preference.hpp>
24 #include <mongocxx/stdx.hpp>
25 #include <mongocxx/write_concern.hpp>
26 
27 #include <mongocxx/config/prelude.hpp>
28 
29 namespace mongocxx {
30 namespace v_noabi {
31 namespace options {
32 namespace gridfs {
33 
37 class bucket {
38  public:
50 
57  const stdx::optional<std::string>& bucket_name() const;
58 
71 
78  const stdx::optional<std::int32_t>& chunk_size_bytes() const;
79 
92 
99  const stdx::optional<mongocxx::v_noabi::read_concern>& read_concern() const;
100 
119 
126  const stdx::optional<mongocxx::v_noabi::read_preference>& read_preference() const;
127 
140 
147  const stdx::optional<mongocxx::v_noabi::write_concern>& write_concern() const;
148 
149  private:
150  stdx::optional<std::string> _bucket_name;
151  stdx::optional<std::int32_t> _chunk_size_bytes;
152  stdx::optional<mongocxx::v_noabi::read_concern> _read_concern;
153  stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
154  stdx::optional<mongocxx::v_noabi::write_concern> _write_concern;
155 };
156 
157 } // namespace gridfs
158 } // namespace options
159 } // namespace v_noabi
160 } // namespace mongocxx
161 
162 #include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to a MongoDB GridFS bucket creation operation.
Definition: bucket.hpp:37
bucket & read_concern(mongocxx::v_noabi::read_concern read_concern)
Sets the read concern to be used when reading from the bucket.
const stdx::optional< std::int32_t > & chunk_size_bytes() const
Gets the size of the chunks in the bucket.
bucket & chunk_size_bytes(std::int32_t chunk_size_bytes)
Sets the size of the chunks in the bucket.
const stdx::optional< std::string > & bucket_name() const
Gets the name of the bucket.
const stdx::optional< mongocxx::v_noabi::write_concern > & write_concern() const
Gets the write concern of the bucket.
bucket & write_concern(mongocxx::v_noabi::write_concern write_concern)
Sets the write concern to be used when writing to the GridFS bucket.
bucket & bucket_name(std::string bucket_name)
Sets the name of the bucket.
bucket & read_preference(mongocxx::v_noabi::read_preference read_preference)
Sets the read preference to be used when reading from the GridFS bucket.
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference() const
Gets the read preference of the bucket.
const stdx::optional< mongocxx::v_noabi::read_concern > & read_concern() const
Gets the read concern of the bucket.
A class to represent the read concern.
Definition: read_concern.hpp:56
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:63
Class representing the server-side requirement for reporting the success of a write operation.
Definition: write_concern.hpp:58
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19