ConnectionInterface.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. namespace Elasticsearch\Connections;
  3. use Elasticsearch\Serializers\SerializerInterface;
  4. use Elasticsearch\Transport;
  5. use Psr\Log\LoggerInterface;
  6. /**
  7. * Interface ConnectionInterface
  8. *
  9. * @category Elasticsearch
  10. * @package Elasticsearch\Connections
  11. * @author Zachary Tong <zach@elastic.co>
  12. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  13. * @link http://elastic.co
  14. */
  15. interface ConnectionInterface
  16. {
  17. /**
  18. * Constructor
  19. *
  20. * @param $handler
  21. * @param array $hostDetails
  22. * @param array $connectionParams connection-specific parameters
  23. * @param \Elasticsearch\Serializers\SerializerInterface $serializer
  24. * @param \Psr\Log\LoggerInterface $log Logger object
  25. * @param \Psr\Log\LoggerInterface $trace Logger object
  26. */
  27. public function __construct(
  28. $handler,
  29. $hostDetails,
  30. $connectionParams,
  31. SerializerInterface $serializer,
  32. LoggerInterface $log,
  33. LoggerInterface $trace
  34. );
  35. /**
  36. * Get the transport schema for this connection
  37. *
  38. * @return string
  39. */
  40. public function getTransportSchema();
  41. /**
  42. * Get the hostname for this connection
  43. *
  44. * @return string
  45. */
  46. public function getHost();
  47. /**
  48. * Get the username:password string for this connection, null if not set
  49. *
  50. * @return null|string
  51. */
  52. public function getUserPass();
  53. /**
  54. * Get the URL path suffix, null if not set
  55. *
  56. * @return null|string;
  57. */
  58. public function getPath();
  59. /**
  60. * Check to see if this instance is marked as 'alive'
  61. *
  62. * @return bool
  63. */
  64. public function isAlive();
  65. /**
  66. * Mark this instance as 'alive'
  67. *
  68. * @return void
  69. */
  70. public function markAlive();
  71. /**
  72. * Mark this instance as 'dead'
  73. *
  74. * @return void
  75. */
  76. public function markDead();
  77. /**
  78. * Return an associative array of information about the last request
  79. *
  80. * @return array
  81. */
  82. public function getLastRequestInfo();
  83. /**
  84. * @param $method
  85. * @param $uri
  86. * @param null $params
  87. * @param null $body
  88. * @param array $options
  89. * @param \Elasticsearch\Transport $transport
  90. * @return mixed
  91. */
  92. // @codingStandardsIgnoreStart
  93. // "Arguments with default values must be at the end of the argument list" - cannot change the interface
  94. public function performRequest($method, $uri, $params = null, $body = null, $options = [], Transport $transport);
  95. // @codingStandardsIgnoreEnd
  96. }