Singleton class to manage Postgres connection pool.
More...
#include <connection_manager.h>
|
void | growPool (unsigned int) |
| Grow the connection pool by the number of connections specified. More...
|
|
unsigned int | shrinkPool (unsigned int) |
| Attempt to shrink the number of connections in the idle pool. More...
|
|
Connection * | allocate () |
| Allocate a connection from the idle pool. More...
|
|
void | release (Connection *) |
| Release a connection back to the idle pool for reallocation. More...
|
|
void | shutdown () |
| Called at shutdown. More...
|
|
void | setError (const char *, const char *, bool) |
| Set the last error information for a plugin. More...
|
|
PLUGIN_ERROR * | getError () |
|
void | setMaxReadingRows (long rows) |
|
void | growPool (unsigned int) |
|
unsigned int | shrinkPool (unsigned int) |
|
Connection * | allocate () |
|
bool | attachNewDb (std::string &path, std::string &alias) |
| Attach a database to all the connections, idle and inuse. More...
|
|
bool | attachRequestNewDb (int newDbId, sqlite3 *dbHandle) |
| Adds to all the connections a request to attach a database. More...
|
|
bool | detachNewDb (std::string &alias) |
| Detach a database from all the connections. More...
|
|
void | release (Connection *) |
|
void | shutdown () |
|
void | setError (const char *, const char *, bool) |
|
PLUGIN_ERROR * | getError () |
|
void | background () |
| Background thread used to execute periodic tasks and oversee the database activity. More...
|
|
void | setVacuumInterval (long hours) |
|
bool | allowMoreDatabases () |
| Determine if we can allow another database to be created and attached to all the connections. More...
|
|
void | setConfiguration (ConfigCategory *category) |
|
std::string | getDBConfiguration () |
| Return the pragma configuration for the database.
|
|
void | growPool (unsigned int) |
|
unsigned int | shrinkPool (unsigned int) |
|
Connection * | allocate () |
|
void | release (Connection *) |
|
void | shutdown () |
|
void | setError (const char *, const char *, bool) |
|
PLUGIN_ERROR * | getError () |
|
void | background () |
|
void | setVacuumInterval (long hours) |
|
void | setPersist (bool persist, const std::string &filename="") |
|
bool | persist () |
|
std::string | filename () |
|
void | setPurgeBlockSize (unsigned long purgeBlockSize) |
| Set the purge block size in each of the connections. More...
|
|
|
bool | m_trace |
|
bool | m_shutdown |
|
std::thread * | m_background |
|
long | m_vacuumInterval |
|
unsigned int | m_descriptorLimit |
|
unsigned int | m_attachedDatabases |
|
DiskSpaceMonitor * | m_diskSpaceMonitor |
|
ConfigCategory * | m_config |
|
bool | m_persist |
|
std::string | m_filename |
|
unsigned long | m_purgeBlockSize |
|
Singleton class to manage Postgres connection pool.
Singleton class to manage SQLite3 connection pool.
◆ allocate()
Allocate a connection from the idle pool.
If no connection is available add a new connection
◆ allowMoreDatabases()
bool ConnectionManager::allowMoreDatabases |
( |
| ) |
|
Determine if we can allow another database to be created and attached to all the connections.
- Returns
- True if we can create another database.
◆ attachNewDb()
bool ConnectionManager::attachNewDb |
( |
std::string & |
path, |
|
|
std::string & |
alias |
|
) |
| |
Attach a database to all the connections, idle and inuse.
- Parameters
-
path | - path of the database to attach |
alias | - alias to be assigned to the attached database |
◆ attachRequestNewDb()
bool ConnectionManager::attachRequestNewDb |
( |
int |
newDbId, |
|
|
sqlite3 * |
dbHandle |
|
) |
| |
Adds to all the connections a request to attach a database.
- Parameters
-
newDbId | - database id to attach |
dbHandle | - dbhandle for which the attach request should NOT be added |
◆ background()
void ConnectionManager::background |
( |
| ) |
|
Background thread used to execute periodic tasks and oversee the database activity.
We will run the SQLite vacuum command periodically to allow space to be reclaimed
We will runt he SQLite vacuum command periodically to allow space to be reclaimed
◆ detachNewDb()
bool ConnectionManager::detachNewDb |
( |
std::string & |
alias | ) |
|
Detach a database from all the connections.
◆ getInstance()
Return the singleton instance of the connection manager.
if none was created then create it.
◆ growPool()
void ConnectionManager::growPool |
( |
unsigned int |
delta | ) |
|
Grow the connection pool by the number of connections specified.
- Parameters
-
delta | The number of connections to add to the pool |
◆ release()
void ConnectionManager::release |
( |
Connection * |
conn | ) |
|
Release a connection back to the idle pool for reallocation.
- Parameters
-
conn | The connection to release. |
◆ setError()
void ConnectionManager::setError |
( |
const char * |
source, |
|
|
const char * |
description, |
|
|
bool |
retryable |
|
) |
| |
Set the last error information for a plugin.
- Parameters
-
source | The source of the error |
description | The error description |
retryable | Flag to determien if the error condition is transient |
◆ setPurgeBlockSize()
void ConnectionManager::setPurgeBlockSize |
( |
unsigned long |
purgeBlockSize | ) |
|
Set the purge block size in each of the connections.
- Parameters
-
purgeBlockSize | The requested purgeBlockSize |
◆ shrinkPool()
unsigned int ConnectionManager::shrinkPool |
( |
unsigned int |
delta | ) |
|
Attempt to shrink the number of connections in the idle pool.
- Parameters
-
delta | Number of connections to attempt to remove |
- Returns
- The number of connections removed.
◆ shutdown()
void ConnectionManager::shutdown |
( |
| ) |
|
Called at shutdown.
Shrink the idle pool, this will have the side effect of closing the connections to the database.
The documentation for this class was generated from the following files:
- C/plugins/storage/postgres/include/connection_manager.h
- C/plugins/storage/postgres/connection_manager.cpp