NAME

DBIO::Storage::Pool - Abstract connection pool interface for async storage

VERSION

version 0.900000

SYNOPSIS

# Implemented by async distributions, e.g.:
package DBIO::EV::Pg::Pool;
use base 'DBIO::Storage::Pool';

sub acquire { ... }   # return Future resolving to a connection
sub release { ... }   # return connection to pool

DESCRIPTION

Defines the interface contract for connection pools used by DBIO::Storage::Async drivers. This is an abstract base -- concrete implementations live in async driver distributions.

Sync storage (DBIO::Storage::DBI) does not use a pool -- it manages a single connection directly. This interface is only relevant for async storage drivers that need to multiplex queries across multiple connections.

METHODS

acquire

my $future = $pool->acquire;

Acquire a connection from the pool. Returns a Future that resolves to a connection handle. If no connections are available, the Future waits until one is released.

release

$pool->release($connection);

Return a connection to the pool, making it available for other queries.

acquire_txn

my $future = $pool->acquire_txn;

Acquire a connection pinned for exclusive transaction use. The connection will not be returned to the general pool until the transaction completes (COMMIT or ROLLBACK).

size

my $n = $pool->size;

Returns the total number of connections in the pool (active + idle).

available

my $n = $pool->available;

Returns the number of idle connections ready for use.

max_size

my $n = $pool->max_size;

Returns the configured maximum pool size.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.