Rename Predis\Connection\AggregatedConnectionInterface.

This commit is contained in:
Daniele Alessandri
2013-12-15 12:38:21 +01:00
parent 6ceebbfbec
commit 58c5029574
15 changed files with 32 additions and 34 deletions
+5 -7
View File
@@ -18,8 +18,6 @@ use Predis\Command\RawCommand;
use Predis\Command\ScriptCommand;
use Predis\Configuration;
use Predis\Connection;
use Predis\Connection\AggregatedConnectionInterface;
use Predis\Connection\ConnectionInterface;
use Predis\Monitor;
use Predis\Pipeline;
use Predis\PubSub;
@@ -89,11 +87,11 @@ class Client implements ClientInterface
* - Callable
*
* @param mixed $parameters Connection parameters or connection instance.
* @return ConnectionInterface
* @return Connection\ConnectionInterface
*/
protected function createConnection($parameters)
{
if ($parameters instanceof ConnectionInterface) {
if ($parameters instanceof Connection\ConnectionInterface) {
return $parameters;
}
@@ -146,7 +144,7 @@ class Client implements ClientInterface
return function () use ($callable) {
$connection = call_user_func_array($callable, func_get_args());
if (!$connection instanceof ConnectionInterface) {
if (!$connection instanceof Connection\ConnectionInterface) {
throw new UnexpectedValueException(
'The callable connection initializer returned an invalid type'
);
@@ -242,9 +240,9 @@ class Client implements ClientInterface
*/
public function getConnectionById($connectionID)
{
if (!$this->connection instanceof AggregatedConnectionInterface) {
if (!$this->connection instanceof Connection\AggregateConnectionInterface) {
throw new NotSupportedException(
'Retrieving connections by ID is supported only when using aggregated connections'
'Retrieving connections by ID is supported only when using aggregate connections'
);
}
@@ -19,7 +19,7 @@ use Predis\Command\CommandInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
interface AggregatedConnectionInterface extends ConnectionInterface
interface AggregateConnectionInterface extends ConnectionInterface
{
/**
* Adds a connection instance to the aggregate connection.
@@ -17,6 +17,6 @@ namespace Predis\Connection;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
interface ClusterConnectionInterface extends AggregatedConnectionInterface
interface ClusterConnectionInterface extends AggregateConnectionInterface
{
}
+1 -1
View File
@@ -106,7 +106,7 @@ class Factory implements FactoryInterface
/**
* {@inheritdoc}
*/
public function aggregate(AggregatedConnectionInterface $connection, array $parameters)
public function aggregate(AggregateConnectionInterface $connection, array $parameters)
{
foreach ($parameters as $node) {
$connection->add($node instanceof SingleConnectionInterface ? $node : $this->create($node));
+2 -2
View File
@@ -44,8 +44,8 @@ interface FactoryInterface
/**
* Aggregates single connections into an aggregate connection instance.
*
* @param AggregatedConnectionInterface $aggregate Aggregate connection instance.
* @param AggregateConnectionInterface $aggregate Aggregate connection instance.
* @param array $parameters List of parameters for each connection.
*/
public function aggregate(AggregatedConnectionInterface $aggregate, array $parameters);
public function aggregate(AggregateConnectionInterface $aggregate, array $parameters);
}
+1 -1
View File
@@ -19,7 +19,7 @@ use Predis\Cluster\Distributor;
use Predis\Command\CommandInterface;
/**
* Abstraction for a cluster of aggregated connections to various Redis servers
* Abstraction for a cluster of aggregate connections to various Redis servers
* implementing client-side sharding based on pluggable distribution strategies.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
@@ -16,7 +16,7 @@ namespace Predis\Connection;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
interface ReplicationConnectionInterface extends AggregatedConnectionInterface
interface ReplicationConnectionInterface extends AggregateConnectionInterface
{
/**
* Switches the internal connection instance in use.
+3 -3
View File
@@ -14,7 +14,7 @@ namespace Predis\Monitor;
use Iterator;
use Predis\ClientInterface;
use Predis\NotSupportedException;
use Predis\Connection\AggregatedConnectionInterface;
use Predis\Connection\AggregateConnectionInterface;
/**
* Redis MONITOR consumer.
@@ -54,9 +54,9 @@ class Consumer implements Iterator
*/
private function assertClient(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregatedConnectionInterface) {
if ($client->getConnection() instanceof AggregateConnectionInterface) {
throw new NotSupportedException(
'Cannot initialize a monitor consumer when using aggregated connections'
'Cannot initialize a monitor consumer when using aggregate connections'
);
}
+3 -3
View File
@@ -15,7 +15,7 @@ use Predis\ClientException;
use Predis\ClientInterface;
use Predis\Command\Command;
use Predis\NotSupportedException;
use Predis\Connection\AggregatedConnectionInterface;
use Predis\Connection\AggregateConnectionInterface;
/**
* PUB/SUB consumer abstraction.
@@ -59,9 +59,9 @@ class Consumer extends AbstractConsumer
*/
private function checkCapabilities(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregatedConnectionInterface) {
if ($client->getConnection() instanceof AggregateConnectionInterface) {
throw new NotSupportedException(
'Cannot initialize a PUB/SUB consumer when using aggregated connections'
'Cannot initialize a PUB/SUB consumer when using aggregate connections'
);
}
+4 -4
View File
@@ -21,7 +21,7 @@ use Predis\ExecutableContextInterface;
use Predis\NotSupportedException;
use Predis\Response;
use Predis\Command\CommandInterface;
use Predis\Connection\AggregatedConnectionInterface;
use Predis\Connection\AggregateConnectionInterface;
use Predis\Protocol\ProtocolException;
/**
@@ -63,9 +63,9 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
*/
private function preconditions(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregatedConnectionInterface) {
if ($client->getConnection() instanceof AggregateConnectionInterface) {
throw new NotSupportedException(
'Cannot initialize a MULTI/EXEC transaction when using aggregated connections'
'Cannot initialize a MULTI/EXEC transaction when using aggregate connections'
);
}
@@ -419,7 +419,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
*/
private function onProtocolError($message)
{
// Since a MULTI/EXEC block cannot be initialized when using aggregated
// Since a MULTI/EXEC block cannot be initialized when using aggregate
// connections we can safely assume that Predis\Client::getConnection()
// will return a Predis\Connection\SingleConnectionInterface instance.
CommunicationException::handle(new ProtocolException(
+4 -4
View File
@@ -579,7 +579,7 @@ class ClientTest extends PredisTestCase
/**
* @group disconnected
*/
public function testGetConnectionFromAggregatedConnectionWithAlias()
public function testGetConnectionFromAggregateConnectionWithAlias()
{
$client = new Client(array('tcp://host1?alias=node01', 'tcp://host2?alias=node02'));
@@ -594,9 +594,9 @@ class ClientTest extends PredisTestCase
/**
* @group disconnected
* @expectedException Predis\NotSupportedException
* @expectedExceptionMessage Retrieving connections by ID is supported only when using aggregated connections
* @expectedExceptionMessage Retrieving connections by ID is supported only when using aggregate connections
*/
public function testGetConnectionByIdWorksOnlyWithAggregatedConnections()
public function testGetConnectionByIdWorksOnlyWithAggregateConnections()
{
$client = new Client();
@@ -606,7 +606,7 @@ class ClientTest extends PredisTestCase
/**
* @group disconnected
*/
public function testCreateClientWithConnectionFromAggregatedConnection()
public function testCreateClientWithConnectionFromAggregateConnection()
{
$client = new Client(array('tcp://host1?alias=node01', 'tcp://host2?alias=node02'), array('prefix' => 'pfx:'));
+3 -3
View File
@@ -265,7 +265,7 @@ class FactoryTest extends PredisTestCase
/**
* @group disconnected
*/
public function testAggregatedConnectionSkipCreationOnConnectionInstance()
public function testAggregateConnectionSkipCreationOnConnectionInstance()
{
list(, $connectionClass) = $this->getMockConnectionClass();
@@ -284,7 +284,7 @@ class FactoryTest extends PredisTestCase
/**
* @group disconnected
*/
public function testAggregatedConnectionWithMixedParameters()
public function testAggregateConnectionWithMixedParameters()
{
list(, $connectionClass) = $this->getMockConnectionClass();
@@ -306,7 +306,7 @@ class FactoryTest extends PredisTestCase
/**
* @group disconnected
*/
public function testAggregatedConnectionWithEmptyListOfParameters()
public function testAggregateConnectionWithEmptyListOfParameters()
{
$cluster = $this->getMock('Predis\Connection\ClusterConnectionInterface');
$cluster->expects($this->never())->method('add');
+1 -1
View File
@@ -41,7 +41,7 @@ class ConsumerTest extends PredisTestCase
/**
* @group disconnected
* @expectedException Predis\NotSupportedException
* @expectedExceptionMessage Cannot initialize a monitor consumer when using aggregated connections
* @expectedExceptionMessage Cannot initialize a monitor consumer when using aggregate connections
*/
public function testMonitorConsumerDoesNotWorkOnClusters()
{
+1 -1
View File
@@ -152,7 +152,7 @@ class AtomicTest extends PredisTestCase
* @expectedException Predis\ClientException
* @expectedExceptionMessage Predis\Pipeline\Atomic can be used only with connections to single nodes
*/
public function testExecutorWithAggregatedConnection()
public function testExecutorWithAggregateConnection()
{
$connection = $this->getMock('Predis\Connection\ClusterConnectionInterface');
$pipeline = new Atomic(new Client($connection));
+1 -1
View File
@@ -40,7 +40,7 @@ class ConsumerTest extends PredisTestCase
/**
* @group disconnected
* @expectedException Predis\NotSupportedException
* @expectedExceptionMessage Cannot initialize a PUB/SUB consumer when using aggregated connections
* @expectedExceptionMessage Cannot initialize a PUB/SUB consumer when using aggregate connections
*/
public function testPubSubConsumerDoesNotWorkOnClusters()
{