Permalink
Browse files

Rename certain namespaces, interfaces and classes.

Now we follow a Symfony2-like naming convention for namespaces, interfaces
and classes sticking with one clear rule.

- Renamed namespaces:

  - Predis\Network
  - Predis\Profiles
  - Predis\Iterators
  - Predis\Options
  - Predis\Commands
  - Predis\Commands\Processors

- Renamed interfaces:

  - Predis\IReplyObject
  - Predis\IRedisServerError
  - Predis\IConnectionFactory
  - Predis\IConnectionParameters
  - Predis\Options\IOption
  - Predis\Options\IClientOptions
  - Predis\Profile\IServerProfile
  - Predis\Pipeline\IPipelineExecutor
  - Predis\Distribution\INodeKeyGenerator
  - Predis\Distribution\IDistributionStrategy
  - Predis\Protocol\IProtocolProcessor
  - Predis\Protocol\IResponseReader
  - Predis\Protocol\IResponseHandler
  - Predis\Protocol\ICommandSerializer
  - Predis\Protocol\IComposableProtocolProcessor
  - Predis\Network\IConnection
  - Predis\Network\IConnectionSingle
  - Predis\Network\IConnectionComposable
  - Predis\Network\IConnectionCluster
  - Predis\Network\IConnectionReplication
  - Predis\Commands\ICommand
  - Predis\Commands\IPrefixable
  - Predis\Command\Processor\ICommandProcessor
  - Predis\Command\Processor\ICommandProcessorChain
  - Predis\Command\Processor\IProcessingSupport

- Renamed Classes:

  - Predis\Commands\Command
  - Predis\Network\ConnectionBase

- Classes moved to different namespaces:

  - Predis\MonitorContext

Meh
  • Loading branch information...
1 parent ce625ca commit dc14c2967668854e3ab32469b20ceb9ffc414ff3 @nrk committed Jan 15, 2012
Showing 406 changed files with 2,138 additions and 2,071 deletions.
View
@@ -1,3 +1,70 @@
+v0.8.0 (201x-xx-xx)
+===============================================================================
+
+- Some namespaces have been renamed:
+
+ - `Predis\Network` => `Predis\Connection`
+ - `Predis\Profiles` => `Predis\Profile`
+ - `Predis\Iterators` => `Predis\Iterator`
+ - `Predis\Options` => `Predis\Option`
+ - `Predis\Commands` => `Predis\Command`
+ - `Predis\Commands\Processors` => `Predis\Command\Processor`
+
+- Some interfaces have been renamed:
+
+ - `Predis\IReplyObject` => `Predis\ResponseObjectInterface`
+ - `Predis\IRedisServerError` => `Predis\ResponseErrorInterface`
+ - `Predis\IConnectionFactory` => `Predis\ConnectionFactoryInterface`
+ - `Predis\IConnectionParameters` => `Predis\ConnectionParametersInterface`
+ - `Predis\Options\IOption` => `Predis\Option\OptionInterface`
+ - `Predis\Options\IClientOptions` => `Predis\Option\ClientOptionsInterface`
+ - `Predis\Profile\IServerProfile` => `Predis\Profile\ServerProfileInterface`
+ - `Predis\Pipeline\IPipelineExecutor`
+ => `Predis\Pipeline\PipelineExecutorInterface`
+ - `Predis\Distribution\INodeKeyGenerator`
+ => `Predis\Distribution\HashGeneratorInterface`
+ - `Predis\Distribution\IDistributionStrategy`
+ => `Predis\Distribution\DistributionStrategyInterface`
+ - `Predis\Protocol\IProtocolProcessor` => `Predis\Protocol\ProtocolInterface`
+ - `Predis\Protocol\IResponseReader`
+ => `Predis\Protocol\ResponseReaderInterface`
+ - `Predis\Protocol\IResponseHandler`
+ => `Predis\Protocol\ResponseHandlerInterface`
+ - `Predis\Protocol\ICommandSerializer`
+ => `Predis\Protocol\CommandSerializerInterface`
+ - `Predis\Protocol\IComposableProtocolProcessor`
+ => `Predis\Protocol\ComposableProtocolInterface`
+ - `Predis\Network\IConnection` => `Predis\Connection\ConnectionInterface`
+ - `Predis\Network\IConnectionSingle`
+ => `Predis\Connection\SingleConnectionInterface`
+ - `Predis\Network\IConnectionComposable`
+ => `Predis\Connection\ComposableConnectionInterface`
+ - `Predis\Network\IConnectionCluster`
+ => `Predis\Connection\ClusterConnectionInterface`
+ - `Predis\Network\IConnectionReplication`
+ => `Predis\Connection\ReplicationConnectionInterface`
+ - `Predis\Commands\ICommand` => `Predis\Command\CommandInterface`
+ - `Predis\Commands\IPrefixable`
+ => `Predis\Command\PrefixableCommandInterface`
+ - `Predis\Command\Processor\ICommandProcessor`
+ => `Predis\Command\Processor\CommandProcessorInterface`
+ - `Predis\Command\Processor\ICommandProcessorChain`
+ => `Predis\Command\Processor\CommandProcessorChainInterface`
+ - `Predis\Command\Processor\IProcessingSupport`
+ => `Predis\Command\Processor\CommandProcessingInterface`
+
+- Some classes have been renamed:
+
+ - `Predis\Commands\Command` => `Predis\Command\AbstractCommand`
+ - `Predis\Network\ConnectionBase` => `Predis\Connection\AbstractConnection`
+
+- Some interfaces and classes have been moved to different namespaces:
+
+ - `Predis\MonitorContext` is now under the `Predis\Monitor`.
+
+- `Predis\Options\Option` is now abstract, see `Predis\Option\AbstractOption`.
+
+
v0.7.2 (2012-xx-xx)
===============================================================================
View
@@ -56,7 +56,7 @@ official Redis C client library) with a thin layer that exposes its features to
get the benefits of a faster protocol parser just by adding a single line of code in your application:
$client = new Predis\Client('tcp://127.0.0.1', array(
- 'connections' => array('tcp' => 'Predis\Network\PhpiredisConnection')
+ 'connections' => array('tcp' => 'Predis\Connection\PhpiredisConnection')
));
As simple as it is, nothing will really change in the way you use the library in your application. So,
View
@@ -114,11 +114,11 @@ $replies = $redis->pipeline(function($pipe) {
Predis allows developers to create new connection classes to add support for new protocols or override
the existing ones and provide a different implementation compared to the default classes. This can be
-obtained by subclassing the `Predis\Network\IConnectionSingle` interface.
+obtained by implementing `Predis\Connection\SingleConnectionInterface`.
``` php
<?php
-class MyConnectionClass implements Predis\Network\IConnectionSingle
+class MyConnectionClass implements Predis\Connection\SingleConnectionInterface
{
// implementation goes here
}
@@ -129,8 +129,8 @@ $client = new Predis\Client('tcp://127.0.0.1', array(
));
```
-The classes contained in the `Predis\Network` namespace give you a better insight with actual code on
-how to create new connection classes.
+The classes contained in the `Predis\Connection` namespace give you a better insight with actual code
+on how to create new connection classes.
### Defining and registering new commands on the client at runtime ###
@@ -143,7 +143,7 @@ runtime. Actually, it is easier done than said:
``` php
<?php
-class BrandNewRedisCommand extends Predis\Commands\Command
+class BrandNewRedisCommand extends Predis\Command\AbstractCommand
{
public function getId()
{
@@ -13,9 +13,9 @@
// -------------------------------------------------------------------------- //
// This script can be used to automatically generate a file with the scheleton
// of a test case to test a Redis command by specifying the name of the class
-// in the Predis\Commands namespace (only classes in this namespace are valid).
+// in the Predis\Command namespace (only classes in this namespace are valid).
// For example, to generate a test case for SET (which is represented by the
-// Predis\Commands\StringSet class):
+// Predis\Command\StringSet class):
//
// $ ./bin/generate-command-test.php --class=StringSet
//
@@ -33,8 +33,8 @@
// is explicitly specified.
// -------------------------------------------------------------------------- //
-use Predis\Commands\ICommand;
-use Predis\Commands\IPrefixable;
+use Predis\Command\CommandInterface;
+use Predis\Command\PrefixableCommandInterface;
class CommandTestCaseGenerator
{
@@ -92,8 +92,8 @@ public static function fromCommandLine()
throw new RuntimeException("Missing 'class' option.");
}
- $options['fqn'] = "Predis\\Commands\\{$options['class']}";
- $options['path'] = "Predis/Commands/{$options['class']}.php";
+ $options['fqn'] = "Predis\\Command\\{$options['class']}";
+ $options['path'] = "Predis/Command/{$options['class']}.php";
$source = __DIR__.'/../lib/'.$options['path'];
if (!file_exists($source)) {
@@ -129,8 +129,8 @@ public function generate()
if (!$reflection->isInstantiable()) {
throw new RuntimeException("Class $class must be instantiable, abstract classes or interfaces are not allowed.");
}
- if (!$reflection->implementsInterface('Predis\Commands\ICommand')) {
- throw new RuntimeException("Class $class must implement the Predis\Commands\ICommand interface.");
+ if (!$reflection->implementsInterface('Predis\Command\CommandInterface')) {
+ throw new RuntimeException("Class $class must implement Predis\Command\CommandInterface.");
}
$instance = $reflection->newInstance();
@@ -148,7 +148,7 @@ public function save()
file_put_contents($options['output'], $this->generate());
}
- protected function getTestCaseBuffer(ICommand $instance)
+ protected function getTestCaseBuffer(CommandInterface $instance)
{
$id = $instance->getId();
$fqn = get_class($instance);
@@ -167,7 +167,7 @@ protected function getTestCaseBuffer(ICommand $instance)
* file that was distributed with this source code.
*/
-namespace Predis\Commands;
+namespace Predis\Command;
use \PHPUnit_Framework_TestCase as StandardTestCase;
@@ -226,7 +226,7 @@ public function testParseResponse()
PHP;
- if ($instance instanceof IPrefixable) {
+ if ($instance instanceof PrefixableCommandInterface) {
$buffer .=<<<PHP
/**
@@ -13,12 +13,12 @@
// Developers can customize the distribution strategy used by the client
// to distribute keys among a cluster of servers simply by creating a class
-// that implements the Predis\Distribution\IDistributionStrategy interface.
+// that implements Predis\Distribution\DistributionStrategyInterface.
-use Predis\Distribution\IDistributionStrategy;
-use Predis\Network\PredisCluster;
+use Predis\Distribution\DistributionStrategyInterface;
+use Predis\Connection\PredisCluster;
-class NaiveDistributionStrategy implements IDistributionStrategy
+class NaiveDistributionStrategy implements DistributionStrategyInterface
{
private $nodes;
private $nodesCount;
@@ -54,7 +54,7 @@ public function get($key)
return $this->nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
}
- public function generateKey($value)
+ public function hash($value)
{
return crc32($value);
}
@@ -13,14 +13,14 @@
// Predis allows to set Lua scripts as read-only operations in the context of
// replication. This works for both EVAL and EVALSHA and also for the client-side
-// abstraction built upon them (Predis\Commands\ScriptedCommand). This example
+// abstraction built upon them (Predis\Command\ScriptedCommand). This example
// shows a slightly more complex configuration that injects a new scripted command
// in the server profile used by the new client instance and marks it marks it as
// a read-only operation for replication so that it will be executed on slaves.
-use Predis\Profiles\ServerProfile;
-use Predis\Commands\ScriptedCommand;
-use Predis\Network\MasterSlaveReplication;
+use Predis\Profile\ServerProfile;
+use Predis\Command\ScriptedCommand;
+use Predis\Connection\MasterSlaveReplication;
// ------------------------------------------------------------------------- //
@@ -14,11 +14,11 @@
// This example will not work with versions of Redis < 2.6.
//
// Additionally to the EVAL command defined in the current development profile, the new
-// Predis\Commands\ScriptedCommand base class can be used to build an higher abstraction
+// Predis\Command\ScriptedCommand base class can be used to build an higher abstraction
// for our "scripted" commands so that they will appear just like any other command on
// the client-side. This is a quick example used to implement INCREX.
-use Predis\Commands\ScriptedCommand;
+use Predis\Command\ScriptedCommand;
class IncrementExistingKey extends ScriptedCommand
{
@@ -12,8 +12,8 @@
require 'SharedConfigurations.php';
use Predis\ConnectionParameters;
-use Predis\Commands\ICommand;
-use Predis\Network\StreamConnection;
+use Predis\Command\CommandInterface;
+use Predis\Connection\StreamConnection;
class SimpleDebuggableConnection extends StreamConnection
{
@@ -27,7 +27,7 @@ public function connect()
parent::connect();
}
- private function storeDebug(ICommand $command, $direction)
+ private function storeDebug(CommandInterface $command, $direction)
{
$firtsArg = $command->getArgument(0);
$timestamp = round(microtime(true) - $this->tstart, 4);
@@ -40,14 +40,14 @@ private function storeDebug(ICommand $command, $direction)
$this->debugBuffer[] = $debug;
}
- public function writeCommand(ICommand $command)
+ public function writeCommand(CommandInterface $command)
{
parent::writeCommand($command);
$this->storeDebug($command, '->');
}
- public function readResponse(ICommand $command)
+ public function readResponse(CommandInterface $command)
{
$reply = parent::readResponse($command);
$this->storeDebug($command, '<-');
Oops, something went wrong.

0 comments on commit dc14c29

Please sign in to comment.