mirror of
https://github.com/predis/predis.git
synced 2026-09-01 05:03:28 +00:00
Create Predis\Cluster namespace and move related classes / interfaces.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
+1
-2
@@ -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
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
+1
-1
@@ -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.
|
||||
@@ -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
|
||||
+1
-1
@@ -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
|
||||
+1
-1
@@ -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.
|
||||
+1
-1
@@ -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
|
||||
+2
-2
@@ -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
|
||||
+2
-2
@@ -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
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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');
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Distribution;
|
||||
namespace Predis\Cluster\Distribution;
|
||||
|
||||
/**
|
||||
* @todo To be improved.
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis\Distribution;
|
||||
namespace Predis\Cluster\Distribution;
|
||||
|
||||
/**
|
||||
* @todo To be improved.
|
||||
+2
-2
@@ -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;
|
||||
|
||||
/**
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user