mirror of
https://github.com/predis/predis.git
synced 2026-08-30 20:21:31 +00:00
Rename default replication class to Predis\Network\MasterSlaveReplication.
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ use Predis\NotSupportedException;
|
||||
*
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
class PredisReplication implements IConnectionReplication
|
||||
class MasterSlaveReplication implements IConnectionReplication
|
||||
{
|
||||
private $disallowed = array();
|
||||
private $readonly = array();
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace Predis\Options;
|
||||
|
||||
use Predis\Network\IConnectionReplication;
|
||||
use Predis\Network\PredisReplication;
|
||||
use Predis\Network\MasterSlaveReplication;
|
||||
|
||||
/**
|
||||
* Option class that returns a replication connection be used by a client.
|
||||
@@ -69,6 +69,6 @@ class ClientReplication extends Option
|
||||
*/
|
||||
public function getDefault(IClientOptions $options)
|
||||
{
|
||||
return new PredisReplication();
|
||||
return new MasterSlaveReplication();
|
||||
}
|
||||
}
|
||||
|
||||
+21
-21
@@ -19,7 +19,7 @@ use Predis\Profiles\ServerProfile;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class PredisReplicationTest extends StandardTestCase
|
||||
class MasterSlaveReplicationTest extends StandardTestCase
|
||||
{
|
||||
/**
|
||||
* @group disconnected
|
||||
@@ -30,7 +30,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave2 = $this->getMockConnection('tcp://host3?alias=slave2');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
$replication->add($slave2);
|
||||
@@ -52,7 +52,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave2 = $this->getMockConnection('tcp://host3?alias=slave2');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -70,7 +70,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
*/
|
||||
public function testThrowsExceptionOnEmptyReplication()
|
||||
{
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->connect();
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
*/
|
||||
public function testThrowsExceptionOnMissingMaster()
|
||||
{
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($this->getMockConnection('tcp://host2?alias=slave1'));
|
||||
|
||||
$replication->connect();
|
||||
@@ -94,7 +94,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
*/
|
||||
public function testThrowsExceptionOnMissingSlave()
|
||||
{
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($this->getMockConnection('tcp://host1?alias=master'));
|
||||
|
||||
$replication->connect();
|
||||
@@ -111,7 +111,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave->expects($this->once())->method('connect');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave);
|
||||
|
||||
@@ -129,7 +129,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave->expects($this->once())->method('isConnected')->will($this->returnValue(true));
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave);
|
||||
$replication->connect();
|
||||
@@ -148,7 +148,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave->expects($this->any())->method('isConnected')->will($this->returnValue(false));
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave);
|
||||
|
||||
@@ -171,7 +171,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave->expects($this->once())->method('disconnect');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave);
|
||||
|
||||
@@ -186,7 +186,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$master = $this->getMockConnection('tcp://host1?alias=master');
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -205,7 +205,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
*/
|
||||
public function testThrowsErrorWhenSwitchingToUnknownConnection()
|
||||
{
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($this->getMockConnection('tcp://host1?alias=master'));
|
||||
$replication->add($this->getMockConnection('tcp://host2?alias=slave1'));
|
||||
|
||||
@@ -222,7 +222,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$master = $this->getMockConnection('tcp://host1?alias=master');
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -243,7 +243,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$master = $this->getMockConnection('tcp://host1?alias=master');
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -264,7 +264,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$master = $this->getMockConnection('tcp://host1?alias=master');
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -293,7 +293,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave1->expects($this->once())->method('writeCommand')->with($cmdExists);
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -316,7 +316,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave1->expects($this->once())->method('readResponse')->with($cmdExists);
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -339,7 +339,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave1->expects($this->once())->method('executeCommand')->with($cmdExists);
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -356,7 +356,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
{
|
||||
$cmd = ServerProfile::getDefault()->createCommand('info');
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($this->getMockConnection('tcp://host1?alias=master'));
|
||||
$replication->add($this->getMockConnection('tcp://host2?alias=slave1'));
|
||||
|
||||
@@ -378,7 +378,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave1->expects($this->once())->method('executeCommand')->with($cmdSet);
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
@@ -404,7 +404,7 @@ class PredisReplicationTest extends StandardTestCase
|
||||
$slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
|
||||
$slave1->expects($this->once())->method('executeCommand')->with($cmdExistsFoo);
|
||||
|
||||
$replication = new PredisReplication();
|
||||
$replication = new MasterSlaveReplication();
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
|
||||
Reference in New Issue
Block a user