Interface for executing queries on a cluster of ClickHouse servers.
More...
#include <userver/storages/clickhouse/cluster.hpp>
|
| Cluster (clients::dns::Resolver &resolver, const impl::ClickhouseSettings &settings, const components::ComponentConfig &config) |
|
| ~Cluster () |
| Cluster destructor.
|
|
| Cluster (const Cluster &)=delete |
|
template<typename... Args> |
ExecutionResult | Execute (const Query &query, const Args &... args) const |
| Execute a statement at some host of the cluster with args as query parameters.
|
|
template<typename... Args> |
ExecutionResult | Execute (OptionalCommandControl, const Query &query, const Args &... args) const |
| Execute a statement with specified command control settings at some host of the cluster with args as query parameters.
|
|
template<typename T > |
void | Insert (const std::string &table_name, const std::vector< std::string_view > &column_names, const T &data) const |
| Insert data at some host of the cluster; T is expected to be a struct of vectors of same length.
|
|
template<typename T > |
void | Insert (OptionalCommandControl, const std::string &table_name, const std::vector< std::string_view > &column_names, const T &data) const |
| Insert data with specified command control settings at some host of the cluster; T is expected to be a struct of vectors of same length.
|
|
template<typename Container > |
void | InsertRows (const std::string &table_name, const std::vector< std::string_view > &column_names, const Container &data) const |
| Insert data at some host of the cluster; Container is expected to be an iterable of clickhouse-mapped type.
|
|
template<typename Container > |
void | InsertRows (OptionalCommandControl, const std::string &table_name, const std::vector< std::string_view > &column_names, const Container &data) const |
| Insert data with specified command control settings at some host of the cluster; Container is expected to be an iterable of clickhouse-mapped type.
|
|
void | WriteStatistics (::utils::statistics::Writer &writer) const |
| Write cluster statistics.
|
|
Interface for executing queries on a cluster of ClickHouse servers.
Usually retrieved from components::ClickHouse component.
Definition at line 36 of file cluster.hpp.
◆ Cluster()
Cluster constructor
- Parameters
-
resolver | asynchronous DNS resolver |
settings | struct with settings fields: endpoints - list of endpoints (host + port) auth_settings - authentication settings (user, password, database) |
config | components::ClickHouse component config |
◆ Execute() [1/2]
template<typename... Args>
ExecutionResult storages::clickhouse::Cluster::Execute |
( |
const Query & |
query, |
|
|
const Args &... |
args |
|
) |
| const |
Execute a statement at some host of the cluster with args as query parameters.
Definition at line 179 of file cluster.hpp.
◆ Execute() [2/2]
template<typename... Args>
Execute a statement with specified command control settings at some host of the cluster with args as query parameters.
Definition at line 185 of file cluster.hpp.
◆ Insert() [1/2]
template<typename T >
void storages::clickhouse::Cluster::Insert |
( |
const std::string & |
table_name, |
|
|
const std::vector< std::string_view > & |
column_names, |
|
|
const T & |
data |
|
) |
| const |
Insert data at some host of the cluster; T
is expected to be a struct of vectors of same length.
- Parameters
-
table_name | table to insert into |
column_names | names of columns of the table |
data | data to insert See clickhouse_io for better understanding of T's requirements. |
Definition at line 141 of file cluster.hpp.
◆ Insert() [2/2]
template<typename T >
void storages::clickhouse::Cluster::Insert |
( |
OptionalCommandControl |
optional_cc, |
|
|
const std::string & |
table_name, |
|
|
const std::vector< std::string_view > & |
column_names, |
|
|
const T & |
data |
|
) |
| const |
Insert data with specified command control settings at some host of the cluster; T
is expected to be a struct of vectors of same length.
- Parameters
-
table_name | table to insert into |
column_names | names of columns of the table |
data | data to insert See clickhouse_io for better understanding of T's requirements. |
Definition at line 148 of file cluster.hpp.
◆ InsertRows() [1/2]
template<typename Container >
void storages::clickhouse::Cluster::InsertRows |
( |
const std::string & |
table_name, |
|
|
const std::vector< std::string_view > & |
column_names, |
|
|
const Container & |
data |
|
) |
| const |
Insert data at some host of the cluster; Container
is expected to be an iterable of clickhouse-mapped type.
- Parameters
-
table_name | table to insert into |
column_names | names of columns of the table |
data | data to insert See clickhouse_io for better understanding of Container::value_type 's requirements. |
- Note
- This version of insert is less performant than
Insert
(it makes 2 copies of data instead of just 1 copy) due to implementation details, so consider using less convenient but more performant analogue if performance is a concern.
Definition at line 159 of file cluster.hpp.
◆ InsertRows() [2/2]
template<typename Container >
void storages::clickhouse::Cluster::InsertRows |
( |
OptionalCommandControl |
optional_cc, |
|
|
const std::string & |
table_name, |
|
|
const std::vector< std::string_view > & |
column_names, |
|
|
const Container & |
data |
|
) |
| const |
Insert data with specified command control settings at some host of the cluster; Container
is expected to be an iterable of clickhouse-mapped type.
- Parameters
-
table_name | table to insert into |
column_names | names of columns of the table |
data | data to insert See clickhouse_io for better understanding of Container::value_type 's requirements. |
- Note
- This version of insert is less performant than
Insert
(it makes 2 copies of data instead of just 1 copy) due to implementation details, so consider using less convenient but more performant analogue if performance is a concern.
Definition at line 166 of file cluster.hpp.
The documentation for this class was generated from the following file: