1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Manticoresearch; |
5
|
|
|
|
6
|
|
|
use Manticoresearch\Endpoints\Nodes\AgentStatus; |
7
|
|
|
use Manticoresearch\Endpoints\Nodes\CreateFunction; |
8
|
|
|
use Manticoresearch\Endpoints\Nodes\CreatePlugin; |
9
|
|
|
use Manticoresearch\Endpoints\Nodes\Debug; |
10
|
|
|
use Manticoresearch\Endpoints\Nodes\DropFunction; |
11
|
|
|
use Manticoresearch\Endpoints\Nodes\DropPlugin; |
12
|
|
|
use Manticoresearch\Endpoints\Nodes\FlushAttributes; |
13
|
|
|
use Manticoresearch\Endpoints\Nodes\FlushHostnames; |
14
|
|
|
use Manticoresearch\Endpoints\Nodes\FlushLogs; |
15
|
|
|
use Manticoresearch\Endpoints\Nodes\Plugins; |
16
|
|
|
use Manticoresearch\Endpoints\Nodes\ReloadIndexes; |
17
|
|
|
use Manticoresearch\Endpoints\Nodes\ReloadPlugins; |
18
|
|
|
use Manticoresearch\Endpoints\Nodes\Set; |
19
|
|
|
use Manticoresearch\Endpoints\Nodes\Status; |
20
|
|
|
use Manticoresearch\Endpoints\Nodes\Tables; |
21
|
|
|
use Manticoresearch\Endpoints\Nodes\Threads; |
22
|
|
|
use Manticoresearch\Endpoints\Nodes\Variables; |
23
|
|
|
use Manticoresearch\Endpoints\Sql; |
24
|
|
|
use Manticoresearch\Response\SqlToArray; |
25
|
|
|
|
26
|
|
|
class Nodes |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var Client |
30
|
|
|
*/ |
31
|
|
|
protected $client; |
32
|
|
|
protected $params = ['responseClass' => SqlToArray::class]; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Nodes namespace |
36
|
|
|
* @param Client $client |
37
|
|
|
*/ |
38
|
|
|
public function __construct($client) |
39
|
|
|
{ |
40
|
|
|
$this->client = $client; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function agentstatus($params = []) |
44
|
|
|
{ |
45
|
|
|
$body = $params['body']??[]; |
46
|
|
|
$endpoint = new AgentStatus(); |
47
|
|
|
$endpoint->setBody($body); |
48
|
|
|
$response = $this->client->request( |
49
|
|
|
$endpoint, |
50
|
|
|
array_merge($this->params, ['responseClassParams' => ['customMapping' => true]]) |
51
|
|
|
); |
52
|
|
|
return $response->getResponse(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function createfunction($params) |
56
|
|
|
{ |
57
|
|
|
$body = $params['body']; |
58
|
|
|
$endpoint = new CreateFunction(); |
59
|
|
|
$endpoint->setBody($body); |
60
|
|
|
$response = $this->client->request($endpoint, $this->params); |
61
|
|
|
return $response->getResponse(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function createplugin($params) |
65
|
|
|
{ |
66
|
|
|
$body = $params['body']; |
67
|
|
|
$endpoint = new CreatePlugin(); |
68
|
|
|
$endpoint->setBody($body); |
69
|
|
|
$response = $this->client->request($endpoint, $this->params); |
70
|
|
|
return $response->getResponse(); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function debug($params) |
74
|
|
|
{ |
75
|
|
|
$body = $params['body']; |
76
|
|
|
$endpoint = new Debug(); |
77
|
|
|
$endpoint->setBody($body); |
78
|
|
|
$response = $this->client->request( |
79
|
|
|
$endpoint, |
80
|
|
|
array_merge($this->params, ['responseClassParams' => ['customMapping' => true]]) |
81
|
|
|
); |
82
|
|
|
return $response->getResponse(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function dropfunction($params) |
86
|
|
|
{ |
87
|
|
|
$body = $params['body']; |
88
|
|
|
$endpoint = new DropFunction(); |
89
|
|
|
$endpoint->setBody($body); |
90
|
|
|
$response = $this->client->request($endpoint, $this->params); |
91
|
|
|
return $response->getResponse(); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function dropplugin($params) |
95
|
|
|
{ |
96
|
|
|
$body = $params['body']; |
97
|
|
|
$endpoint = new DropPlugin(); |
98
|
|
|
$endpoint->setBody($body); |
99
|
|
|
$response = $this->client->request($endpoint, $this->params); |
100
|
|
|
return $response->getResponse(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function flushattributes($params = []) |
104
|
|
|
{ |
105
|
|
|
$body = $params['body']??[]; |
106
|
|
|
$endpoint = new FlushAttributes(); |
107
|
|
|
$endpoint->setBody($body); |
108
|
|
|
$response = $this->client->request($endpoint, ['responseClass'=> Response\Sql::class]); |
109
|
|
|
return $response->getResponse(); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function flushhostnames($params = []) |
113
|
|
|
{ |
114
|
|
|
$body = $params['body']??[]; |
115
|
|
|
$endpoint = new FlushHostnames(); |
116
|
|
|
$endpoint->setBody($body); |
117
|
|
|
$response = $this->client->request($endpoint, $this->params); |
118
|
|
|
return $response->getResponse(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function flushlogs($params = []) |
122
|
|
|
{ |
123
|
|
|
$body = $params['body']??[]; |
124
|
|
|
$endpoint = new FlushLogs(); |
125
|
|
|
$endpoint->setBody($body); |
126
|
|
|
$response = $this->client->request($endpoint, $this->params); |
127
|
|
|
return $response->getResponse(); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function plugins($params = []) |
131
|
|
|
{ |
132
|
|
|
$body = $params['body']??[]; |
133
|
|
|
$endpoint = new Plugins(); |
134
|
|
|
$endpoint->setBody($body); |
135
|
|
|
$response = $this->client->request($endpoint, $this->params); |
136
|
|
|
return $response->getResponse(); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function reloadindexes($params = []) |
140
|
|
|
{ |
141
|
|
|
$body = $params['body']??[]; |
142
|
|
|
$endpoint = new ReloadIndexes(); |
143
|
|
|
$endpoint->setBody($body); |
144
|
|
|
$response = $this->client->request($endpoint, $this->params); |
145
|
|
|
return $response->getResponse(); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public function reloadplugins($params = []) |
149
|
|
|
{ |
150
|
|
|
$body = $params['body']??[]; |
151
|
|
|
$endpoint = new ReloadPlugins(); |
152
|
|
|
$endpoint->setBody($body); |
153
|
|
|
$response = $this->client->request($endpoint, $this->params); |
154
|
|
|
return $response->getResponse(); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function set($params) |
158
|
|
|
{ |
159
|
|
|
$body = $params['body']; |
160
|
|
|
$endpoint = new Set(); |
161
|
|
|
$endpoint->setBody($body); |
162
|
|
|
$response = $this->client->request($endpoint, $this->params); |
163
|
|
|
return $response->getResponse(); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param array $params |
168
|
|
|
* @return mixed |
169
|
|
|
*/ |
170
|
|
|
public function status($params = []) |
171
|
|
|
{ |
172
|
|
|
$body = $params['body']??[]; |
173
|
|
|
$endpoint = new Status(); |
174
|
|
|
$endpoint->setBody($body); |
175
|
|
|
$response = $this->client->request( |
176
|
|
|
$endpoint, |
177
|
|
|
array_merge($this->params, ['responseClassParams' => ['customMapping' => true]]) |
178
|
|
|
); |
179
|
|
|
return $response->getResponse(); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function tables($params = []) |
183
|
|
|
{ |
184
|
|
|
$body = $params['body']??[]; |
185
|
|
|
$endpoint = new Tables(); |
186
|
|
|
$endpoint->setBody($body); |
187
|
|
|
$response = $this->client->request( |
188
|
|
|
$endpoint, |
189
|
|
|
array_merge($this->params, ['responseClassParams' => ['customMapping' => true]]) |
190
|
|
|
); |
191
|
|
|
return $response->getResponse(); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
public function threads($params = []) |
195
|
|
|
{ |
196
|
|
|
$body = $params['body']??[]; |
197
|
|
|
$endpoint = new Threads(); |
198
|
|
|
$endpoint->setBody($body); |
199
|
|
|
$response = $this->client->request($endpoint, $this->params); |
200
|
|
|
return $response->getResponse(); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public function variables($params = []) |
204
|
|
|
{ |
205
|
|
|
$body = $params['body']??[]; |
206
|
|
|
$endpoint = new Variables(); |
207
|
|
|
$endpoint->setBody($body); |
208
|
|
|
$response = $this->client->request( |
209
|
|
|
$endpoint, |
210
|
|
|
array_merge($this->params, ['responseClassParams' => ['customMapping' => true]]) |
211
|
|
|
); |
212
|
|
|
return $response->getResponse(); |
213
|
|
|
} |
214
|
|
|
} |
215
|
|
|
|