1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-27 04:24:45 +01:00
postgres/lib/AggregatePool.php
2017-03-17 10:17:24 -05:00

35 lines
724 B
PHP

<?php
namespace Amp\Postgres;
use Amp\Promise;
class AggregatePool extends AbstractPool {
/**
* @param \Amp\Postgres\Connection $connection
*/
public function addConnection(Connection $connection) {
parent::addConnection($connection);
}
/**
* {@inheritdoc}
*/
protected function createConnection(): Promise {
throw new PoolError("Creating connections is not available in an aggregate pool");
}
/**
* {@inheritdoc}
*/
public function getMaxConnections(): int {
$count = $this->getConnectionCount();
if (!$count) {
throw new PoolError("No connections in aggregate pool");
}
return $count;
}
}