MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
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 <bsoncxx/stdx/optional.hpp>
20#include <mongocxx/read_concern.hpp>
21#include <mongocxx/read_preference.hpp>
22#include <mongocxx/stdx.hpp>
23#include <mongocxx/write_concern.hpp>
24
25#include <mongocxx/config/prelude.hpp>
26
27namespace mongocxx {
28MONGOCXX_INLINE_NAMESPACE_BEGIN
29namespace options {
30namespace gridfs {
31
35class MONGOCXX_API bucket {
36 public:
47 bucket& bucket_name(std::string bucket_name);
48
55 const stdx::optional<std::string>& bucket_name() const;
56
68 bucket& chunk_size_bytes(std::int32_t chunk_size_bytes);
69
76 const stdx::optional<std::int32_t>& chunk_size_bytes() const;
77
90
97 const stdx::optional<class read_concern>& read_concern() const;
98
117
124 const stdx::optional<class read_preference>& read_preference() const;
125
138
145 const stdx::optional<class write_concern>& write_concern() const;
146
147 private:
148 stdx::optional<std::string> _bucket_name;
149 stdx::optional<std::int32_t> _chunk_size_bytes;
150 stdx::optional<class read_concern> _read_concern;
151 stdx::optional<class read_preference> _read_preference;
152 stdx::optional<class write_concern> _write_concern;
153};
154
155} // namespace gridfs
156} // namespace options
157MONGOCXX_INLINE_NAMESPACE_END
158} // namespace mongocxx
159
160#include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to a MongoDB GridFS bucket creation operation.
Definition bucket.hpp:35
bucket & bucket_name(std::string bucket_name)
Sets the name of the bucket.
bucket & write_concern(class write_concern write_concern)
Sets the write concern to be used when writing to the GridFS bucket.
bucket & read_preference(class read_preference read_preference)
Sets the read preference to be used when reading from the GridFS bucket.
const stdx::optional< class write_concern > & write_concern() const
Gets the write concern of the bucket.
bucket & read_concern(class read_concern read_concern)
Sets the read concern to be used when reading from the bucket.
const stdx::optional< class read_concern > & read_concern() const
Gets the read concern of 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< class read_preference > & read_preference() const
Gets the read preference of the bucket.
const stdx::optional< std::string > & bucket_name() const
Gets the name of the bucket.
A class to represent the read concern.
Definition read_concern.hpp:54
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:56
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24