Skip to content

Commit 4fb152a

Browse files
committed
update Swoole Library for v6.0.0-beta
Signed-off-by: Demin Yin <deminy@deminy.net>
1 parent 7628f64 commit 4fb152a

File tree

11 files changed

+266
-37
lines changed

11 files changed

+266
-37
lines changed

src/swoole_library/src/__init__.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
'core/NameResolver/Redis.php',
8888
'core/NameResolver/Nacos.php',
8989
'core/NameResolver/Consul.php',
90+
# <core for Thread> #
91+
'core/Thread/Pool.php',
92+
'core/Thread/Runnable.php',
9093
# <core for functions> #
9194
'core/Coroutine/functions.php',
9295
# <ext> #

src/swoole_library/src/core/Constant.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class Constant
125125

126126
public const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';
127127

128+
public const OPTION_IOURING_ENTRIES = 'iouring_entries';
129+
128130
public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';
129131

130132
public const OPTION_WAIT_SIGNAL = 'wait_signal';
@@ -281,36 +283,16 @@ class Constant
281283

282284
public const OPTION_UPLOAD_TMP_DIR = 'upload_tmp_dir';
283285

284-
public const OPTION_HOST = 'host';
285-
286-
public const OPTION_PORT = 'port';
287-
288-
public const OPTION_SSL = 'ssl';
289-
290-
public const OPTION_USER = 'user';
291-
292-
public const OPTION_PASSWORD = 'password';
293-
294-
public const OPTION_DATABASE = 'database';
295-
296-
public const OPTION_CHARSET = 'charset';
297-
298-
public const OPTION_STRICT_TYPE = 'strict_type';
299-
300-
public const OPTION_FETCH_MODE = 'fetch_mode';
301-
302286
public const OPTION_ENABLE_MESSAGE_BUS = 'enable_message_bus';
303287

304288
public const OPTION_MAX_PACKAGE_SIZE = 'max_package_size';
305289

306-
public const OPTION_SERIALIZE = 'serialize';
307-
308-
public const OPTION_RECONNECT = 'reconnect';
309-
310-
public const OPTION_COMPATIBILITY_MODE = 'compatibility_mode';
290+
public const OPTION_SSL = 'ssl';
311291

312292
public const OPTION_CHROOT = 'chroot';
313293

294+
public const OPTION_USER = 'user';
295+
314296
public const OPTION_GROUP = 'group';
315297

316298
public const OPTION_DAEMONIZE = 'daemonize';
@@ -407,6 +389,10 @@ class Constant
407389

408390
public const OPTION_MESSAGE_QUEUE_KEY = 'message_queue_key';
409391

392+
public const OPTION_BOOTSTRAP = 'bootstrap';
393+
394+
public const OPTION_INIT_ARGUMENTS = 'init_arguments';
395+
410396
public const OPTION_BACKLOG = 'backlog';
411397

412398
public const OPTION_KERNEL_SOCKET_RECV_BUFFER_SIZE = 'kernel_socket_recv_buffer_size';

src/swoole_library/src/core/Coroutine/Barrier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function make(): self
4747
/**
4848
* @throws Exception
4949
*/
50-
public static function wait(Barrier &$barrier, float $timeout = -1)
50+
public static function wait(Barrier &$barrier, float $timeout = -1): void
5151
{
5252
if ($barrier->cid !== -1) {
5353
throw new Exception('The barrier is waiting, cannot wait again.');

src/swoole_library/src/core/Coroutine/Http/functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function request(
2222
mixed $data = null,
2323
?array $options = null,
2424
?array $headers = null,
25-
?array $cookies = null
25+
?array $cookies = null,
2626
): ClientProxy {
2727
$driver = swoole_library_get_option('http_client_driver');
2828
return match ($driver) {
@@ -41,7 +41,7 @@ function request_with_http_client(
4141
mixed $data = null,
4242
?array $options = null,
4343
?array $headers = null,
44-
?array $cookies = null
44+
?array $cookies = null,
4545
): ClientProxy {
4646
$info = parse_url($url);
4747
if (empty($info['scheme'])) {
@@ -85,7 +85,7 @@ function request_with_curl(
8585
mixed $data = null,
8686
?array $options = null,
8787
?array $headers = null,
88-
?array $cookies = null
88+
?array $cookies = null,
8989
): ClientProxy {
9090
$ch = curl_init($url);
9191
if (empty($ch)) {
@@ -154,7 +154,7 @@ function request_with_stream(
154154
mixed $data = null,
155155
?array $options = null,
156156
?array $headers = null,
157-
?array $cookies = null
157+
?array $cookies = null,
158158
): ClientProxy {
159159
$stream_options = [
160160
'http' => [

src/swoole_library/src/core/FastCGI/Record.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ final public static function unpack(string $binaryData): static
9898
$self->requestId,
9999
$self->contentLength,
100100
$self->paddingLength,
101-
$self->reserved
101+
$self->reserved,
102102
] = array_values($packet);
103103

104104
$payload = substr($binaryData, FastCGI::HEADER_LEN);
@@ -205,7 +205,7 @@ protected static function unpackPayload(self $self, string $binaryData): void
205205
}
206206
[
207207
$self->contentData,
208-
$self->paddingData
208+
$self->paddingData,
209209
] = array_values($payload);
210210
}
211211

src/swoole_library/src/core/FastCGI/Record/BeginRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected static function unpackPayload($self, string $binaryData): void
9797
[
9898
$self->role,
9999
$self->flags,
100-
$self->reserved1
100+
$self->reserved1,
101101
] = array_values($payload);
102102
}
103103

src/swoole_library/src/core/FastCGI/Record/EndRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected static function unpackPayload($self, string $binaryData): void
9898
[
9999
$self->appStatus,
100100
$self->protocolStatus,
101-
$self->reserved1
101+
$self->reserved1,
102102
] = array_values($payload);
103103
}
104104

src/swoole_library/src/core/Server/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Admin
6767

6868
private static string $accessToken = '';
6969

70-
public static function init(Server $server)
70+
public static function init(Server $server): void
7171
{
7272
$accepted_process_types = SWOOLE_SERVER_COMMAND_MASTER |
7373
SWOOLE_SERVER_COMMAND_MANAGER |

src/swoole_library/src/core/Server/Helper.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ class Helper
111111
'output_buffer_size' => true,
112112
'buffer_output_size' => true,
113113
'message_queue_key' => true,
114+
'init_arguments' => true,
115+
'bootstrap' => true,
114116
];
115117

116118
public const PORT_OPTIONS = [
@@ -201,7 +203,7 @@ class Helper
201203
'admin_server' => true,
202204
];
203205

204-
public static function checkOptions(array $input_options)
206+
public static function checkOptions(array $input_options): void
205207
{
206208
$const_options = self::GLOBAL_OPTIONS + self::SERVER_OPTIONS + self::PORT_OPTIONS
207209
+ self::AIO_OPTIONS + self::COROUTINE_OPTIONS + self::HELPER_OPTIONS;
@@ -215,7 +217,7 @@ public static function checkOptions(array $input_options)
215217
}
216218
}
217219

218-
public static function onBeforeStart(Server $server)
220+
public static function onBeforeStart(Server $server): void
219221
{
220222
if (!empty($server->setting['admin_server'])) {
221223
Admin::init($server);
@@ -230,7 +232,7 @@ public static function onBeforeShutdown(Server $server): void
230232
}
231233
}
232234

233-
public static function onWorkerStart(Server $server, int $workerId)
235+
public static function onWorkerStart(Server $server, int $workerId): void
234236
{
235237
if (!empty($server->setting['stats_file']) and $workerId == 0) {
236238
$interval_ms = empty($server->setting['stats_timer_interval']) ? self::STATS_TIMER_INTERVAL_TIME : intval($server->setting['stats_timer_interval']);
@@ -254,7 +256,7 @@ public static function onWorkerStart(Server $server, int $workerId)
254256
}
255257
}
256258

257-
public static function onWorkerExit(Server $server, int $workerId)
259+
public static function onWorkerExit(Server $server, int $workerId): void
258260
{
259261
if ($server->stats_timer) {
260262
Timer::clear($server->stats_timer);

0 commit comments

Comments
 (0)