mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-17 17:47:12 +00:00
Updated CRT library, test process, EventLoopGroup API updates (#16)
* Updated to latest aws-crt-ffi, updated EventLoopGroup/options init * Removed test-ci target, just use test for everything now * Added event_loop_group API to CRT/stubs * Removed headers (all generated) from format-check * Added the ability to force extension vs FFI * make test will now trigger composer run test/phpunit, and force tests with both FFI and extension * Updated builder version, removed redundant php7 test run * Removed type annotations that anger php5, limited backends on php5
This commit is contained in:
+8
-2
@@ -10,6 +10,12 @@ function aws_crt_error_str(int $error_code): string {}
|
||||
|
||||
function aws_crt_error_debug_str(int $error_code): string {}
|
||||
|
||||
function aws_crt_event_loop_group_new(int $max_threads): int {}
|
||||
function aws_crt_event_loop_group_options_new(): object {}
|
||||
|
||||
function aws_crt_event_loop_group_release(int $event_loop_group): void {}
|
||||
function aws_crt_event_loop_group_options_release(object $elg_options): void {}
|
||||
|
||||
function aws_crt_event_loop_group_options_set_max_threads(object $elg_options, int $max_threads): void {}
|
||||
|
||||
function aws_crt_event_loop_group_new(object $options): object {}
|
||||
|
||||
function aws_crt_event_loop_group_release(object $event_loop_group): void {}
|
||||
|
||||
+21
-3
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 04ff04fec5e4293918658ac98394d98387fa977b */
|
||||
* Stub hash: a2ad6edf64d0416356ba2a9a4c8b184615054a7c */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_last_error, 0, 0, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -12,12 +12,24 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 1, IS_LONG, 0)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_options_new, 0, 0, IS_OBJECT, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_options_release, 0, 1, IS_VOID, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, elg_options, IS_OBJECT, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_options_set_max_threads, 0, 2, IS_VOID, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, elg_options, IS_OBJECT, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, max_threads, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 1, IS_OBJECT, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, options, IS_OBJECT, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 1, IS_VOID, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, event_loop_group, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, event_loop_group, IS_OBJECT, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
||||
@@ -25,6 +37,9 @@ ZEND_FUNCTION(aws_crt_last_error);
|
||||
ZEND_FUNCTION(aws_crt_error_name);
|
||||
ZEND_FUNCTION(aws_crt_error_str);
|
||||
ZEND_FUNCTION(aws_crt_error_debug_str);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_options_new);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_options_release);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_options_set_max_threads);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_new);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_release);
|
||||
|
||||
@@ -34,6 +49,9 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name)
|
||||
ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str)
|
||||
ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str)
|
||||
ZEND_FE(aws_crt_event_loop_group_options_new, arginfo_aws_crt_event_loop_group_options_new)
|
||||
ZEND_FE(aws_crt_event_loop_group_options_release, arginfo_aws_crt_event_loop_group_options_release)
|
||||
ZEND_FE(aws_crt_event_loop_group_options_set_max_threads, arginfo_aws_crt_event_loop_group_options_set_max_threads)
|
||||
ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new)
|
||||
ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release)
|
||||
ZEND_FE_END
|
||||
|
||||
@@ -81,14 +81,43 @@ PHP_FUNCTION(aws_crt_error_debug_str) {
|
||||
AWS_RETURN_STRING(aws_crt_error_debug_str(error_code));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_new) {
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_options_new) {
|
||||
aws_crt_event_loop_group_options *options = aws_crt_event_loop_group_options_new();
|
||||
RETURN_LONG((zend_ulong)options);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_options_release) {
|
||||
zend_ulong php_options = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &php_options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
aws_crt_event_loop_group_options *options = (void *)php_options;
|
||||
aws_crt_event_loop_group_options_release(options);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_options_set_max_threads) {
|
||||
zend_ulong php_options = 0;
|
||||
zend_ulong num_threads = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num_threads) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &php_options, &num_threads) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
struct aws_event_loop_group *elg = aws_crt_event_loop_group_new(num_threads);
|
||||
aws_crt_event_loop_group_options *options = (void *)php_options;
|
||||
aws_crt_event_loop_group_options_set_max_threads(options, num_threads);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_new) {
|
||||
zend_ulong php_options = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &php_options) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
aws_crt_event_loop_group_options *options = (void *)php_options;
|
||||
struct aws_event_loop_group *elg = aws_crt_event_loop_group_new(options);
|
||||
RETURN_LONG((zend_ulong)elg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user