1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15
16
17declare(strict_types = 1);
18
19namespace Elasticsearch\Connections;
20
21use Elasticsearch\Serializers\SerializerInterface;
22use Elasticsearch\Transport;
23use Psr\Log\LoggerInterface;
24
25interface ConnectionInterface
26{
27    /**
28     * Get the transport schema for this connection
29     */
30    public function getTransportSchema(): string;
31
32    /**
33     * Get the hostname for this connection
34     */
35    public function getHost(): string;
36
37    /**
38     * Get the port for this connection
39     *
40     * @return int
41     */
42    public function getPort();
43
44    /**
45     * Get the username:password string for this connection, null if not set
46     */
47    public function getUserPass(): ?string;
48
49    /**
50     * Get the URL path suffix, null if not set
51     */
52    public function getPath(): ?string;
53
54    /**
55     * Check to see if this instance is marked as 'alive'
56     */
57    public function isAlive(): bool;
58
59    /**
60     * Mark this instance as 'alive'
61     */
62    public function markAlive(): void;
63
64    /**
65     * Mark this instance as 'dead'
66     */
67    public function markDead(): void;
68
69    /**
70     * Return an associative array of information about the last request
71     */
72    public function getLastRequestInfo(): array;
73
74    /**
75     * @param  null $body
76     * @return mixed
77     */
78    public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], Transport $transport = null);
79}
80