ReplicationInterface.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Connection\Aggregate;
  11. use Predis\Connection\AggregateConnectionInterface;
  12. use Predis\Connection\NodeConnectionInterface;
  13. /**
  14. * Defines a group of Redis nodes in a master / slave replication setup.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. interface ReplicationInterface extends AggregateConnectionInterface
  19. {
  20. /**
  21. * Switches the internal connection instance in use.
  22. *
  23. * @param string $connection Alias of a connection
  24. */
  25. public function switchTo($connection);
  26. /**
  27. * Returns the connection instance currently in use by the aggregate
  28. * connection.
  29. *
  30. * @return NodeConnectionInterface
  31. */
  32. public function getCurrent();
  33. /**
  34. * Returns the connection instance for the master Redis node.
  35. *
  36. * @return NodeConnectionInterface
  37. */
  38. public function getMaster();
  39. /**
  40. * Returns a list of connection instances to slave nodes.
  41. *
  42. * @return NodeConnectionInterface
  43. */
  44. public function getSlaves();
  45. }