abstract class
CQL::ConnectionSource
- CQL::ConnectionSource
- Reference
- Object
Overview
Where a Schema borrows its connections and transactions from. The Schema
keeps the per-fiber transaction pinning and the telemetry; a source only
knows how to lend a connection and how to open a transaction on one.
DatabaseSource (crystal-db's pool) is the default. Postgres::EngineSource
runs a schema on the native AsyncEngine's pool.
Direct Known Subclasses
Defined in:
connection_source.crInstance Method Summary
-
#adapter : Adapter | Nil
The adapter this source speaks, when it is bound to one (a
Schemarefuses a different one). - #close : Nil
-
#database_uri(uri : String) : String
The URI a
Schemareports (Schema#uri), which code such asSchemaDumpopens through crystal-db. - #pool_stats : PoolStats
-
#transaction(& : DB::Transaction -> _)
Runs the block in a transaction on one connection: committed when the block returns, rolled back when it raises.
-
#using_connection(& : DB::Connection -> _)
Lends one connection to the block and takes it back afterwards.
Instance Method Detail
The adapter this source speaks, when it is bound to one (a Schema refuses a different one).
The URI a Schema reports (Schema#uri), which code such as SchemaDump opens through crystal-db.
Runs the block in a transaction on one connection: committed when the
block returns, rolled back when it raises. DB::Rollback rolls back
quietly and makes this return nil.
Lends one connection to the block and takes it back afterwards.