MongoDB C++ Driver
current
Loading...
Searching...
No Matches
src
mongocxx
include
mongocxx
v_noabi
mongocxx
pool.hpp
1
// Copyright 2015 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 <functional>
18
#include <memory>
19
20
#include <mongocxx/client-fwd.hpp>
21
#include <mongocxx/options/auto_encryption-fwd.hpp>
22
#include <mongocxx/pool-fwd.hpp>
23
24
#include <bsoncxx/stdx/optional.hpp>
25
#include <mongocxx/options/pool.hpp>
26
#include <mongocxx/stdx.hpp>
27
#include <mongocxx/uri.hpp>
28
29
#include <mongocxx/config/prelude.hpp>
30
31
namespace
mongocxx
{
32
namespace
v_noabi {
33
49
class
pool
{
50
public
:
62
explicit
pool
(
const
uri
& mongodb_uri =
mongocxx::v_noabi::uri
(),
63
const
options::pool
& options =
options::pool
());
64
68
~pool
();
69
77
class
MONGOCXX_API
entry
{
78
public
:
80
client
*
operator->
() const& noexcept;
81
client
* operator->() && = delete;
82
84
client
& operator*() const& noexcept;
85
client
& operator*() && = delete;
86
88
entry
& operator=(std::nullptr_t) noexcept;
89
91
explicit operator
bool
() const noexcept;
92
93
private:
94
friend ::
mongocxx
::v_noabi::
pool
;
95
96
using unique_client = std::unique_ptr<
client
, std::function<
void
MONGOCXX_CALL(
client
*)>>;
97
98
MONGOCXX_PRIVATE explicit
entry
(unique_client);
99
100
unique_client _client;
101
};
102
107
entry
acquire();
108
113
stdx::optional<
entry
> try_acquire();
114
115
private:
116
friend ::
mongocxx
::v_noabi::options::auto_encryption;
117
118
MONGOCXX_PRIVATE
void
_release(
client
*
client
);
119
120
class MONGOCXX_PRIVATE impl;
121
const std::unique_ptr<impl> _impl;
122
};
123
124
}
// namespace v_noabi
125
}
// namespace mongocxx
126
127
#include <mongocxx/config/postlude.hpp>
mongocxx::v_noabi::client
Class representing a client connection to MongoDB.
Definition
client.hpp:61
mongocxx::v_noabi::options::pool
Class representing the optional arguments to a MongoDB driver pool object.
Definition
pool.hpp:31
mongocxx::v_noabi::pool::entry
An entry is a handle on a client object acquired via the pool.
Definition
pool.hpp:77
mongocxx::v_noabi::pool::entry::operator->
client * operator->() const &noexcept
Access a member of the client instance.
mongocxx::v_noabi::pool
A pool of client objects associated with a MongoDB deployment.
Definition
pool.hpp:49
mongocxx::v_noabi::pool::pool
pool(const uri &mongodb_uri=mongocxx::v_noabi::uri(), const options::pool &options=options::pool())
Creates a pool associated with a connection string.
mongocxx::v_noabi::pool::~pool
~pool()
Destroys a pool.
mongocxx::v_noabi::uri
Class representing a MongoDB connection string URI.
Definition
uri.hpp:47
mongocxx
The top-level namespace for mongocxx library entities.
Definition
bulk_write-fwd.hpp:19
Generated by
1.9.8