Commit Graph

7 Commits

Author SHA1 Message Date
Brian J. Cardiff f13846b133
Refactor connection factory (#181)
* Start moving out URI from ConnectionContext

Create connections with an initial context. Database will set itself as context after connection has been created

* Migrate to simpler/decoupled factory in driver

This allows more freedom on how the connection is created. It will no longer need to have an explicit reference to the connection URI

* Introduce DB::Connection::Options

Move prepared_statements out from ConnectionContext

* Delegate options parsing to driver

DRY parsing connection options for database

* Introduce DB::Pool::Options

* Rename Driver#connection_pool_options to pool_options

* Drop driver getter from database

* Drop uri getter from database

* Add public Database#initialize method

* Drop :nodoc: Database#initialize

* Pass spec helper explicitly (to access methods within each spec)

* Update docs

* Update src/db/pool.cr

Co-authored-by: Beta Ziliani <beta@manas.tech>

* Use ConnectionBuilder instead of procs

* Fix inferred type when there is a single concrete connection type

* Update src/db/driver.cr

Co-authored-by: Beta Ziliani <beta@manas.tech>

---------

Co-authored-by: Beta Ziliani <beta@manas.tech>
2023-06-22 22:03:08 -03:00
Stephen von Takach 6dc3f2dd6f
fix(pool): returning closed resources to the pool (#154) 2021-09-06 19:02:43 -03:00
Brian J. Cardiff 09b8997636 Add before_checkout/after_release callbacks for resources in pool (#36)
add auto_release to DB::Connection (default true on each pool checkout).
fixes #35.
2017-01-16 16:47:58 -03:00
Brian J. Cardiff 8d891a5a4e changes needed due to 3c91978d36
add posibility to inspect availability of a resource in a pool (testing only)
allow access to internal connection pool of db (testing only)
2016-08-29 13:14:47 -03:00
Ary Borenszweig 1cce4685ff Make DB::Pool accept a block 2016-07-11 15:38:31 -03:00
Brian J. Cardiff a2c22c16cf allow DB to use a connection pool.
allow Driver to parse connection pool options for extensibility.
fix waiting_resource counter after a timeout was generated.
2016-07-07 15:50:09 -03:00
Brian J. Cardiff 421996b952 resource pool implementation with
* max_pool_size
* initial_pool_size
* max_idle_pool_size
* checkout_timeout
configuration options
2016-07-05 15:21:39 -03:00