1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Connections;
6
7use Elasticsearch\Serializers\SerializerInterface;
8use Elasticsearch\Transport;
9use Psr\Log\LoggerInterface;
10
11/**
12 * Interface ConnectionInterface
13 *
14 * @category Elasticsearch
15 * @package  Elasticsearch\Connections
16 * @author   Zachary Tong <zach@elastic.co>
17 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
18 * @link     http://elastic.co
19 */
20interface ConnectionInterface
21{
22    /**
23     * Get the transport schema for this connection
24     */
25    public function getTransportSchema(): string;
26
27    /**
28     * Get the hostname for this connection
29     */
30    public function getHost(): string;
31
32    /**
33     * Get the port for this connection
34     *
35     * @return int
36     */
37    public function getPort();
38
39    /**
40     * Get the username:password string for this connection, null if not set
41     */
42    public function getUserPass(): ?string;
43
44    /**
45     * Get the URL path suffix, null if not set
46     */
47    public function getPath(): ?string;
48
49    /**
50     * Check to see if this instance is marked as 'alive'
51     */
52    public function isAlive(): bool;
53
54    /**
55     * Mark this instance as 'alive'
56     */
57    public function markAlive(): void;
58
59    /**
60     * Mark this instance as 'dead'
61     */
62    public function markDead(): void;
63
64    /**
65     * Return an associative array of information about the last request
66     */
67    public function getLastRequestInfo(): array;
68
69    /**
70     * @param  null $body
71     * @return mixed
72     */
73    public function performRequest(string $method, string $uri, array $params = [], $body = null, array $options = [], Transport $transport = null);
74}
75