|
Databricks C++ SDK 0.2.4
Interact with Databricks via an SDK
|
Thread-safe connection pool for managing Databricks connections. More...
#include <connection_pool.h>
Classes | |
| class | PooledConnection |
| RAII wrapper for a pooled connection. More... | |
| struct | Stats |
| Get current pool statistics. More... | |
Public Member Functions | |
| ConnectionPool (const AuthConfig &auth, const SQLConfig &sql, size_t min_connections=1, size_t max_connections=10) | |
| Construct a ConnectionPool with modular configurations. | |
| ~ConnectionPool () | |
| Destructor - closes all connections. | |
| ConnectionPool (const ConnectionPool &)=delete | |
| ConnectionPool & | operator= (const ConnectionPool &)=delete |
| ConnectionPool (ConnectionPool &&)=delete | |
| ConnectionPool & | operator= (ConnectionPool &&)=delete |
| PooledConnection | acquire () |
| Acquire a connection from the pool. | |
| void | warm_up () |
| Pre-warm the pool by creating minimum connections. | |
| std::future< void > | warm_up_async () |
| Asynchronously pre-warm the pool. | |
| Stats | get_stats () const |
| Get current pool statistics. | |
| void | shutdown () |
| Shutdown the pool and close all connections. | |
Friends | |
| class | PooledConnection |
Thread-safe connection pool for managing Databricks connections.
ADVANCED API: Most users should enable pooling via PoolingConfig instead.
This class is for advanced users who need fine-grained control over connection pooling. For typical use cases, simply set pooling.enabled = true when building a Client, and pooling will be handled automatically.
The ConnectionPool manages a pool of reusable ODBC connections to improve performance by eliminating connection overhead for repeated operations.
Definition at line 30 of file connection_pool.h.
| databricks::ConnectionPool::ConnectionPool | ( | const AuthConfig & | auth, |
| const SQLConfig & | sql, | ||
| size_t | min_connections = 1, |
||
| size_t | max_connections = 10 |
||
| ) |
Construct a ConnectionPool with modular configurations.
| auth | Authentication configuration |
| sql | SQL configuration |
| min_connections | Minimum connections to maintain |
| max_connections | Maximum connections allowed |
| databricks::ConnectionPool::~ConnectionPool | ( | ) |
Destructor - closes all connections.
|
delete |
|
delete |
| PooledConnection databricks::ConnectionPool::acquire | ( | ) |
Acquire a connection from the pool.
If no connections are available and the pool is not at max capacity, a new connection is created. Otherwise, waits for a connection to become available (up to connection_timeout_ms).
| std::runtime_error | if timeout occurs or connection fails |
| Stats databricks::ConnectionPool::get_stats | ( | ) | const |
Get current pool statistics.
|
delete |
|
delete |
| void databricks::ConnectionPool::shutdown | ( | ) |
Shutdown the pool and close all connections.
| void databricks::ConnectionPool::warm_up | ( | ) |
Pre-warm the pool by creating minimum connections.
Creates min_connections in the pool without blocking. Useful for reducing initial latency.
| std::future< void > databricks::ConnectionPool::warm_up_async | ( | ) |
Asynchronously pre-warm the pool.
Creates min_connections in the background.
|
friend |
Definition at line 179 of file connection_pool.h.