Ver Fonte

Rename Predis\Distribution\IDistributionAlgorithm to Predis\Distribution\IDistributionStrategy.

Daniele Alessandri há 15 anos atrás
pai
commit
9f21cb12a2
3 ficheiros alterados com 10 adições e 10 exclusões
  1. 3 3
      CHANGELOG
  2. 1 1
      README.markdown
  3. 6 6
      lib/Predis.php

+ 3 - 3
CHANGELOG

@@ -30,12 +30,12 @@ v0.6.0 (2010-05-??)
         option accepts an instance of Predis\RedisServerProfile or a string 
         that indicates the target version.
       - key_distribution [default: Predis\Distribution\HashRing]
-        specifies which key distribution algorithm to use to distribute keys 
+        specifies which key distribution strategy to use to distribute keys 
         among the servers that compose a cluster. This option accepts an 
-        instance of Predis\Distribution\IDistributionAlgorithm so that users 
+        instance of Predis\Distribution\IDistributionStrategy so that users 
         can implement their own key distribution strategy. Optionally, the new 
         Predis\Distribution\KetamaPureRing class also provides a pure-PHP 
-        implementation of the Ketama algorithm.
+        implementation of the same algorithm used by libketama.
       - throw_on_error [default: TRUE]
         server errors can optionally be handled "silently": instead of throwing 
         an exception, the client returns an error response type.

+ 1 - 1
README.markdown

@@ -18,7 +18,7 @@ to be implemented soon in Predis.
 ## Main features ##
 
 - Full support for Redis 2.0. Different versions of Redis are supported via server profiles.
-- Client-side sharding (support for consistent hashing and custom distribution algorithms).
+- Client-side sharding (support for consistent hashing and custom distribution strategies).
 - Command pipelining on single and multiple connections (transparent).
 - Lazy connections (connections to Redis instances are only established just in time).
 - Flexible system to define and register your own set of commands to a client instance.

+ 6 - 6
lib/Predis.php

@@ -279,12 +279,12 @@ class ClientOptionsProfile implements IClientOptionsHandler {
 
 class ClientOptionsKeyDistribution implements IClientOptionsHandler {
     public function validate($option, $value) {
-        if ($value instanceof \Predis\Distribution\IDistributionAlgorithm) {
+        if ($value instanceof \Predis\Distribution\IDistributionStrategy) {
             return $value;
         }
         if (is_string($value)) {
             $valueReflection = new \ReflectionClass($value);
-            if ($valueReflection->isSubclassOf('\Predis\Distribution\IDistributionAlgorithm')) {
+            if ($valueReflection->isSubclassOf('\Predis\Distribution\IDistributionStrategy')) {
                 return new $value;
             }
         }
@@ -389,7 +389,7 @@ abstract class Command {
         return true;
     }
 
-    public function getHash(Distribution\IDistributionAlgorithm $distributor) {
+    public function getHash(Distribution\IDistributionStrategy $distributor) {
         if (isset($this->_hash)) {
             return $this->_hash;
         }
@@ -1248,7 +1248,7 @@ class Connection implements IConnection {
 class ConnectionCluster implements IConnection, \IteratorAggregate {
     private $_pool, $_distributor;
 
-    public function __construct(Distribution\IDistributionAlgorithm $distributor = null) {
+    public function __construct(Distribution\IDistributionStrategy $distributor = null) {
         $this->_pool = array();
         $this->_distributor = $distributor ?: new Distribution\HashRing();
     }
@@ -1800,7 +1800,7 @@ class SafeClusterExecutor implements IPipelineExecutor {
 
 namespace Predis\Distribution;
 
-interface IDistributionAlgorithm {
+interface IDistributionStrategy {
     public function add($node, $weight = null);
     public function remove($node);
     public function get($key);
@@ -1809,7 +1809,7 @@ interface IDistributionAlgorithm {
 
 class EmptyRingException extends \Exception { }
 
-class HashRing implements IDistributionAlgorithm {
+class HashRing implements IDistributionStrategy {
     const DEFAULT_REPLICAS = 128;
     const DEFAULT_WEIGHT   = 100;
     private $_nodes, $_ring, $_ringKeys, $_ringKeysCount, $_replicas;