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