|
VSQLite++ 0.3
|
Thread-safe pool for leasing reusable SQLite connections. More...
#include <connection_pool.hpp>

Classes | |
| class | lease |
Public Types | |
| using | connection_factory = std::function<std::shared_ptr<connection>()> |
Public Member Functions | |
| connection_pool (std::size_t capacity, connection_factory factory) | |
Constructs a pool with a maximum capacity and a factory used to create new connections. | |
| lease | acquire () |
| Blocks until a connection is available and returns a scoped lease. | |
| std::size_t | capacity () const |
| Maximum number of concurrent connections the pool will create. | |
| std::size_t | idle_count () const |
| Number of idle connections currently waiting in the pool. | |
| std::size_t | created_count () const |
| Number of connections that have been created so far. | |
Static Public Member Functions | |
| static connection_factory | make_factory (std::string db, open_mode mode=open_mode::open_or_create, filesystem_adapter_ptr fs={}) |
| Helper that captures the parameters for creating connections inside a pool factory. | |
Private Member Functions | |
| void | release (std::shared_ptr< connection > conn) |
Private Attributes | |
| std::shared_ptr< pool_state > | state_ |
Friends | |
| class | lease |
Thread-safe pool for leasing reusable SQLite connections.
Definition at line 55 of file connection_pool.hpp.
| using sqlite::v2::connection_pool::connection_factory = std::function<std::shared_ptr<connection>()> |
Definition at line 59 of file connection_pool.hpp.
| sqlite::v2::connection_pool::connection_pool | ( | std::size_t | capacity, |
| connection_factory | factory ) |
Constructs a pool with a maximum capacity and a factory used to create new connections.
References capacity().
Referenced by sqlite::v2::connection_pool::lease::lease().

| lease sqlite::v2::connection_pool::acquire | ( | ) |
Blocks until a connection is available and returns a scoped lease.
| std::size_t sqlite::v2::connection_pool::capacity | ( | ) | const |
Maximum number of concurrent connections the pool will create.
Referenced by connection_pool().
| std::size_t sqlite::v2::connection_pool::created_count | ( | ) | const |
Number of connections that have been created so far.
| std::size_t sqlite::v2::connection_pool::idle_count | ( | ) | const |
Number of idle connections currently waiting in the pool.
|
static |
Helper that captures the parameters for creating connections inside a pool factory.
References sqlite::v2::open_or_create.
|
private |
|
friend |
Definition at line 113 of file connection_pool.hpp.
|
private |
Definition at line 116 of file connection_pool.hpp.