userver
C++ Async Framework
Loading...
Searching...
No Matches
database.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/database.hpp
4
/// @brief @copybrief storages::postgres::Database
5
6
#
include
<
vector
>
7
8
#
include
<
userver
/
storages
/
postgres
/
database_fwd
.
hpp
>
9
#
include
<
userver
/
storages
/
postgres
/
dsn
.
hpp
>
10
#
include
<
userver
/
storages
/
postgres
/
options
.
hpp
>
11
#
include
<
userver
/
storages
/
postgres
/
postgres_fwd
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
components
{
16
17
class
Postgres
;
18
19
}
// namespace components
20
21
namespace
storages::
postgres
{
22
23
/// Object for accessing PostgreSQL database instance (sharded or not)
24
class
Database
{
25
public
:
26
/// Cluster accessor for default shard number
27
ClusterPtr
GetCluster
()
const
;
28
29
/// Cluster accessor for specific shard number
30
ClusterPtr
GetClusterForShard
(size_t shard)
const
;
31
32
/// Get total shard count
33
size_t
GetShardCount
()
const
{
return
clusters_.size(); }
34
35
void
UpdateClusterDescription(
const
std::vector<DsnList>&);
36
37
private
:
38
friend
class
components
::
Postgres
;
39
std::vector<storages::postgres::ClusterPtr> clusters_;
40
};
41
42
}
// namespace storages::postgres
43
44
USERVER_NAMESPACE_END
userver
storages
postgres
database.hpp
Generated on Fri Jan 31 2025 09:44:49 for userver by
Doxygen
1.10.0