diff --git a/examples/CustomDistributionStrategy.php b/examples/CustomDistributionStrategy.php index 08a5facc..052b6c03 100644 --- a/examples/CustomDistributionStrategy.php +++ b/examples/CustomDistributionStrategy.php @@ -16,8 +16,8 @@ require 'SharedConfigurations.php'; // that implements Predis\Distribution\DistributionStrategyInterface. use Predis\Connection\PredisCluster; -use Predis\Distribution\DistributionStrategyInterface; -use Predis\Distribution\HashGeneratorInterface; +use Predis\Cluster\Distribution\DistributionStrategyInterface; +use Predis\Cluster\Hash\HashGeneratorInterface; class NaiveDistributionStrategy implements DistributionStrategyInterface, HashGeneratorInterface { diff --git a/lib/Predis/Command/Hash/CommandHashStrategyInterface.php b/lib/Predis/Cluster/CommandHashStrategyInterface.php similarity index 93% rename from lib/Predis/Command/Hash/CommandHashStrategyInterface.php rename to lib/Predis/Cluster/CommandHashStrategyInterface.php index a241f1db..bfea0503 100644 --- a/lib/Predis/Command/Hash/CommandHashStrategyInterface.php +++ b/lib/Predis/Cluster/CommandHashStrategyInterface.php @@ -9,10 +9,9 @@ * file that was distributed with this source code. */ -namespace Predis\Command\Hash; +namespace Predis\Cluster; use Predis\Command\CommandInterface; -use Predis\Distribution\HashGeneratorInterface; /** * Interface for classes defining the strategy used to calculate an hash diff --git a/lib/Predis/Distribution/DistributionStrategyInterface.php b/lib/Predis/Cluster/Distribution/DistributionStrategyInterface.php similarity index 91% rename from lib/Predis/Distribution/DistributionStrategyInterface.php rename to lib/Predis/Cluster/Distribution/DistributionStrategyInterface.php index c4bf4ce8..9bec753d 100644 --- a/lib/Predis/Distribution/DistributionStrategyInterface.php +++ b/lib/Predis/Cluster/Distribution/DistributionStrategyInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; /** * A distributor implements the logic to automatically distribute @@ -44,7 +44,7 @@ interface DistributionStrategyInterface /** * Returns the underlying hash generator instance. * - * @return HashGeneratorInterface + * @return Predis\Cluster\Hash\HashGeneratorInterface */ public function getHashGenerator(); } diff --git a/lib/Predis/Distribution/EmptyRingException.php b/lib/Predis/Cluster/Distribution/EmptyRingException.php similarity index 91% rename from lib/Predis/Distribution/EmptyRingException.php rename to lib/Predis/Cluster/Distribution/EmptyRingException.php index ffc39076..ed08ca3e 100644 --- a/lib/Predis/Distribution/EmptyRingException.php +++ b/lib/Predis/Cluster/Distribution/EmptyRingException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; /** * Exception class that identifies empty rings. diff --git a/lib/Predis/Distribution/HashRing.php b/lib/Predis/Cluster/Distribution/HashRing.php similarity index 98% rename from lib/Predis/Distribution/HashRing.php rename to lib/Predis/Cluster/Distribution/HashRing.php index 4a75107d..7764d33d 100644 --- a/lib/Predis/Distribution/HashRing.php +++ b/lib/Predis/Cluster/Distribution/HashRing.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; + +use Predis\Cluster\Hash\HashGeneratorInterface; /** * This class implements an hashring-based distributor that uses the same diff --git a/lib/Predis/Distribution/KetamaPureRing.php b/lib/Predis/Cluster/Distribution/KetamaPureRing.php similarity index 97% rename from lib/Predis/Distribution/KetamaPureRing.php rename to lib/Predis/Cluster/Distribution/KetamaPureRing.php index cc31a5dc..9e3c5708 100644 --- a/lib/Predis/Distribution/KetamaPureRing.php +++ b/lib/Predis/Cluster/Distribution/KetamaPureRing.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; /** * This class implements an hashring-based distributor that uses the same diff --git a/lib/Predis/Distribution/CRC16HashGenerator.php b/lib/Predis/Cluster/Hash/CRC16HashGenerator.php similarity index 99% rename from lib/Predis/Distribution/CRC16HashGenerator.php rename to lib/Predis/Cluster/Hash/CRC16HashGenerator.php index d4dd8bf9..dff4f28c 100644 --- a/lib/Predis/Distribution/CRC16HashGenerator.php +++ b/lib/Predis/Cluster/Hash/CRC16HashGenerator.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Hash; /** * This class implements the CRC-CCITT-16 algorithm used by redis-cluster. diff --git a/lib/Predis/Distribution/HashGeneratorInterface.php b/lib/Predis/Cluster/Hash/HashGeneratorInterface.php similarity index 95% rename from lib/Predis/Distribution/HashGeneratorInterface.php rename to lib/Predis/Cluster/Hash/HashGeneratorInterface.php index 0695512d..891320d1 100644 --- a/lib/Predis/Distribution/HashGeneratorInterface.php +++ b/lib/Predis/Cluster/Hash/HashGeneratorInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Hash; /** * A generator of node keys implements the logic used to calculate the hash of diff --git a/lib/Predis/Command/Hash/PredisClusterHashStrategy.php b/lib/Predis/Cluster/PredisClusterHashStrategy.php similarity index 99% rename from lib/Predis/Command/Hash/PredisClusterHashStrategy.php rename to lib/Predis/Cluster/PredisClusterHashStrategy.php index 5ee991fb..50b3acc2 100644 --- a/lib/Predis/Command/Hash/PredisClusterHashStrategy.php +++ b/lib/Predis/Cluster/PredisClusterHashStrategy.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Predis\Command\Hash; +namespace Predis\Cluster; +use Predis\Cluster\Hash\HashGeneratorInterface; use Predis\Command\CommandInterface; -use Predis\Distribution\HashGeneratorInterface; /** * Default class used by Predis for client-side sharding to calculate diff --git a/lib/Predis/Command/Hash/RedisClusterHashStrategy.php b/lib/Predis/Cluster/RedisClusterHashStrategy.php similarity index 99% rename from lib/Predis/Command/Hash/RedisClusterHashStrategy.php rename to lib/Predis/Cluster/RedisClusterHashStrategy.php index 7692a376..1b1fd84e 100644 --- a/lib/Predis/Command/Hash/RedisClusterHashStrategy.php +++ b/lib/Predis/Cluster/RedisClusterHashStrategy.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Predis\Command\Hash; +namespace Predis\Cluster; +use Predis\Cluster\Hash\CRC16HashGenerator; use Predis\Command\CommandInterface; -use Predis\Distribution\CRC16HashGenerator; /** * Default class used by Predis to calculate hashes out of keys of diff --git a/lib/Predis/Connection/PredisCluster.php b/lib/Predis/Connection/PredisCluster.php index e0d790ab..bfa75f66 100644 --- a/lib/Predis/Connection/PredisCluster.php +++ b/lib/Predis/Connection/PredisCluster.php @@ -13,10 +13,10 @@ namespace Predis\Connection; use Predis\ClientException; use Predis\NotSupportedException; +use Predis\Cluster\PredisClusterHashStrategy; +use Predis\Cluster\Distribution\DistributionStrategyInterface; +use Predis\Cluster\Distribution\HashRing; use Predis\Command\CommandInterface; -use Predis\Command\Hash\PredisClusterHashStrategy; -use Predis\Distribution\HashRing; -use Predis\Distribution\DistributionStrategyInterface; /** * Abstraction for a cluster of aggregated connections to various Redis servers @@ -168,7 +168,7 @@ class PredisCluster implements ClusterConnectionInterface, \IteratorAggregate, \ * Returns the underlying command hash strategy used to hash * commands by their keys. * - * @return CommandHashStrategy + * @return Predis\Cluster\CommandHashStrategyInterface */ public function getCommandHashStrategy() { diff --git a/lib/Predis/Connection/RedisCluster.php b/lib/Predis/Connection/RedisCluster.php index 43665f70..1a6f26f5 100644 --- a/lib/Predis/Connection/RedisCluster.php +++ b/lib/Predis/Connection/RedisCluster.php @@ -14,10 +14,8 @@ namespace Predis\Connection; use Predis\ClientException; use Predis\NotSupportedException; use Predis\ResponseErrorInterface; +use Predis\Cluster\RedisClusterHashStrategy; use Predis\Command\CommandInterface; -use Predis\Command\Hash\CommandHashStrategyInterface; -use Predis\Command\Hash\RedisClusterHashStrategy; -use Predis\Distribution\CRC16HashGenerator; /** * Abstraction for Redis cluster (Redis v3.0). @@ -266,7 +264,7 @@ class RedisCluster implements ClusterConnectionInterface, \IteratorAggregate, \C * Returns the underlying command hash strategy used to hash * commands by their keys. * - * @return CommandHashStrategy + * @return Predis\Cluster\CommandHashStrategyInterface */ public function getCommandHashStrategy() { diff --git a/tests/PHPUnit/DistributionStrategyTestCase.php b/tests/PHPUnit/DistributionStrategyTestCase.php index 1cc8ce79..1097d488 100644 --- a/tests/PHPUnit/DistributionStrategyTestCase.php +++ b/tests/PHPUnit/DistributionStrategyTestCase.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; use \PHPUnit_Framework_TestCase as StandardTestCase; @@ -21,7 +21,7 @@ abstract class DistributionStrategyTestCase extends StandardTestCase /** * Returns a new instance of the tested distributor. * - * @return Predis\Distribution\DistributionStrategyInterface + * @return Predis\Cluster\Distribution\DistributionStrategyInterface */ protected abstract function getDistributorInstance(); @@ -49,7 +49,7 @@ abstract class DistributionStrategyTestCase extends StandardTestCase */ public function testEmptyRingThrowsException() { - $this->setExpectedException('Predis\Distribution\EmptyRingException'); + $this->setExpectedException('Predis\Cluster\Distribution\EmptyRingException'); $ring = $this->getDistributorInstance(); $ring->get('nodekey'); diff --git a/tests/Predis/Distribution/EmptyRingExceptionTest.php b/tests/Predis/Cluster/Distribution/EmptyRingExceptionTest.php similarity index 81% rename from tests/Predis/Distribution/EmptyRingExceptionTest.php rename to tests/Predis/Cluster/Distribution/EmptyRingExceptionTest.php index a17a9039..9a11e0c4 100644 --- a/tests/Predis/Distribution/EmptyRingExceptionTest.php +++ b/tests/Predis/Cluster/Distribution/EmptyRingExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; use \PHPUnit_Framework_TestCase as StandardTestCase; @@ -24,7 +24,7 @@ class EmptyRingExceptionTest extends StandardTestCase public function testExceptionMessage() { $message = 'Empty Ring'; - $this->setExpectedException('Predis\Distribution\EmptyRingException', $message); + $this->setExpectedException('Predis\Cluster\Distribution\EmptyRingException', $message); throw new EmptyRingException($message); } diff --git a/tests/Predis/Distribution/HashRingTest.php b/tests/Predis/Cluster/Distribution/HashRingTest.php similarity index 98% rename from tests/Predis/Distribution/HashRingTest.php rename to tests/Predis/Cluster/Distribution/HashRingTest.php index a4277dd2..ca94bcc7 100644 --- a/tests/Predis/Distribution/HashRingTest.php +++ b/tests/Predis/Cluster/Distribution/HashRingTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; /** * @todo To be improved. diff --git a/tests/Predis/Distribution/KetamaPureRingTest.php b/tests/Predis/Cluster/Distribution/KetamaPureRingTest.php similarity index 98% rename from tests/Predis/Distribution/KetamaPureRingTest.php rename to tests/Predis/Cluster/Distribution/KetamaPureRingTest.php index 86cfa72e..47a0cca5 100644 --- a/tests/Predis/Distribution/KetamaPureRingTest.php +++ b/tests/Predis/Cluster/Distribution/KetamaPureRingTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Distribution; +namespace Predis\Cluster\Distribution; /** * @todo To be improved. diff --git a/tests/Predis/Command/Hash/PredisClusterHashStrategyTest.php b/tests/Predis/Cluster/PredisClusterHashStrategyTest.php similarity index 99% rename from tests/Predis/Command/Hash/PredisClusterHashStrategyTest.php rename to tests/Predis/Cluster/PredisClusterHashStrategyTest.php index 51909679..acf690f6 100644 --- a/tests/Predis/Command/Hash/PredisClusterHashStrategyTest.php +++ b/tests/Predis/Cluster/PredisClusterHashStrategyTest.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Predis\Command\Hash; +namespace Predis\Cluster; use \PHPUnit_Framework_TestCase as StandardTestCase; -use Predis\Distribution\HashRing; +use Predis\Cluster\Distribution\HashRing; use Predis\Profile\ServerProfile; /** diff --git a/tests/Predis/Command/Hash/RedisClusterHashStrategyTest.php b/tests/Predis/Cluster/RedisClusterHashStrategyTest.php similarity index 99% rename from tests/Predis/Command/Hash/RedisClusterHashStrategyTest.php rename to tests/Predis/Cluster/RedisClusterHashStrategyTest.php index bc73c9f7..6eb26e25 100644 --- a/tests/Predis/Command/Hash/RedisClusterHashStrategyTest.php +++ b/tests/Predis/Cluster/RedisClusterHashStrategyTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Command\Hash; +namespace Predis\Cluster; use \PHPUnit_Framework_TestCase as StandardTestCase; diff --git a/tests/Predis/Connection/PredisClusterTest.php b/tests/Predis/Connection/PredisClusterTest.php index ee13a4aa..01d24dcb 100644 --- a/tests/Predis/Connection/PredisClusterTest.php +++ b/tests/Predis/Connection/PredisClusterTest.php @@ -26,7 +26,7 @@ class PredisClusterTest extends StandardTestCase public function testExposesCommandHashStrategy() { $cluster = new PredisCluster(); - $this->assertInstanceOf('Predis\Command\Hash\PredisClusterHashStrategy', $cluster->getCommandHashStrategy()); + $this->assertInstanceOf('Predis\Cluster\PredisClusterHashStrategy', $cluster->getCommandHashStrategy()); } /**