This is an automated email from the ASF dual-hosted git repository. dinglei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/rocketmq-ons-cpp.git
commit f9f6d84f21ceeeccff31566cdaa79e7a0522e330 Author: ShannonDing <[email protected]> AuthorDate: Wed Jul 24 14:45:32 2019 +0800 Fix Head file include path --- graalvm_artifacts/graal_isolate.h | 103 ++++++++++++++++++++++ graalvm_artifacts/graal_isolate_dynamic.h | 103 ++++++++++++++++++++++ graalvm_artifacts/rocketmq-ons-cpp-full.h | 44 +++++++++ graalvm_artifacts/rocketmq-ons-cpp-full_dynamic.h | 44 +++++++++ src/main/cpp/benchmark/ProducerBenchmark.cpp | 2 +- src/main/cpp/sdk/ConsumerImpl.cpp | 2 +- src/main/cpp/sdk/OrderConsumerImpl.cpp | 2 +- src/main/cpp/sdk/OrderProducerImpl.cpp | 2 +- src/main/cpp/sdk/ProducerImpl.cpp | 2 +- src/main/cpp/sdk/TransactionProducerImpl.cpp | 2 +- 10 files changed, 300 insertions(+), 6 deletions(-) diff --git a/graalvm_artifacts/graal_isolate.h b/graalvm_artifacts/graal_isolate.h new file mode 100644 index 0000000..b98df75 --- /dev/null +++ b/graalvm_artifacts/graal_isolate.h @@ -0,0 +1,103 @@ +#ifndef __GRAAL_ISOLATE_H +#define __GRAAL_ISOLATE_H + +/* + * Structure representing an isolate. A pointer to such a structure can be + * passed to an entry point as the execution context. + */ +struct __graal_isolate_t; +typedef struct __graal_isolate_t graal_isolate_t; + +/* + * Structure representing a thread that is attached to an isolate. A pointer to + * such a structure can be passed to an entry point as the execution context, + * requiring that the calling thread has been attached to that isolate. + */ +struct __graal_isolatethread_t; +typedef struct __graal_isolatethread_t graal_isolatethread_t; + +#ifdef _WIN64 +typedef unsigned long long ulong; +#else +typedef unsigned long ulong; +#endif + + +/* Parameters for the creation of a new isolate. */ +enum { __graal_create_isolate_params_version = 1 }; +struct __graal_create_isolate_params_t { + int version; /* Version of this struct */ + + /* Fields introduced in version 1 */ + ulong reserved_address_space_size; /* Size of address space to reserve */ +}; +typedef struct __graal_create_isolate_params_t graal_create_isolate_params_t; + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * Create a new isolate, considering the passed parameters (which may be NULL). + * Returns 0 on success, or a non-zero value on failure. + * On success, the current thread is attached to the created isolate, and the + * address of the isolate and the isolate thread are written to the passed pointers + * if they are not NULL. + */ +int graal_create_isolate(graal_create_isolate_params_t* params, graal_isolate_t** isolate, graal_isolatethread_t** thread); + +/* + * Attaches the current thread to the passed isolate. + * On failure, returns a non-zero value. On success, writes the address of the + * created isolate thread structure to the passed pointer and returns 0. + * If the thread has already been attached, the call succeeds and also provides + * the thread's isolate thread structure. + */ +int graal_attach_thread(graal_isolate_t* isolate, graal_isolatethread_t** thread); + +/* + * Given an isolate to which the current thread is attached, returns the address of + * the thread's associated isolate thread structure. If the current thread is not + * attached to the passed isolate or if another error occurs, returns NULL. + */ +graal_isolatethread_t* graal_get_current_thread(graal_isolate_t* isolate); + +/* + * Given an isolate thread structure, determines to which isolate it belongs and returns + * the address of its isolate structure. If an error occurs, returns NULL instead. + */ +graal_isolate_t* graal_get_isolate(graal_isolatethread_t* thread); + +/* + * Detaches the passed isolate thread from its isolate and discards any state or + * context that is associated with it. At the time of the call, no code may still + * be executing in the isolate thread's context. + * Returns 0 on success, or a non-zero value on failure. + */ +int graal_detach_thread(graal_isolatethread_t* thread); + +/* + * Using the context of the isolate thread from the first argument, detaches the + * threads in an array pointed to by the second argument, with the length of the + * array given in the third argument. All of the passed threads must be in the + * same isolate, including the first argument. None of the threads to detach may + * execute Java code at the time of the call or later without reattaching first, + * or their behavior will be entirely undefined. The current thread may be part of + * the array, however, using detach_thread() should be preferred for detaching only + * the current thread. + * Returns 0 on success, or a non-zero value on failure. + */ +int graal_detach_threads(graal_isolatethread_t* thread, graal_isolatethread_t** array, int length); + +/* + * Tears down the passed isolate, waiting for any attached threads to detach from + * it, then discards the isolate's objects, threads, and any other state or context + * that is associated with it. + * Returns 0 on success, or a non-zero value on failure. + */ +int graal_tear_down_isolate(graal_isolatethread_t* isolateThread); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/graalvm_artifacts/graal_isolate_dynamic.h b/graalvm_artifacts/graal_isolate_dynamic.h new file mode 100644 index 0000000..17b0f42 --- /dev/null +++ b/graalvm_artifacts/graal_isolate_dynamic.h @@ -0,0 +1,103 @@ +#ifndef __GRAAL_ISOLATE_H +#define __GRAAL_ISOLATE_H + +/* + * Structure representing an isolate. A pointer to such a structure can be + * passed to an entry point as the execution context. + */ +struct __graal_isolate_t; +typedef struct __graal_isolate_t graal_isolate_t; + +/* + * Structure representing a thread that is attached to an isolate. A pointer to + * such a structure can be passed to an entry point as the execution context, + * requiring that the calling thread has been attached to that isolate. + */ +struct __graal_isolatethread_t; +typedef struct __graal_isolatethread_t graal_isolatethread_t; + +#ifdef _WIN64 +typedef unsigned long long ulong; +#else +typedef unsigned long ulong; +#endif + + +/* Parameters for the creation of a new isolate. */ +enum { __graal_create_isolate_params_version = 1 }; +struct __graal_create_isolate_params_t { + int version; /* Version of this struct */ + + /* Fields introduced in version 1 */ + ulong reserved_address_space_size; /* Size of address space to reserve */ +}; +typedef struct __graal_create_isolate_params_t graal_create_isolate_params_t; + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * Create a new isolate, considering the passed parameters (which may be NULL). + * Returns 0 on success, or a non-zero value on failure. + * On success, the current thread is attached to the created isolate, and the + * address of the isolate and the isolate thread are written to the passed pointers + * if they are not NULL. + */ +typedef int (*graal_create_isolate_fn_t)(graal_create_isolate_params_t* params, graal_isolate_t** isolate, graal_isolatethread_t** thread); + +/* + * Attaches the current thread to the passed isolate. + * On failure, returns a non-zero value. On success, writes the address of the + * created isolate thread structure to the passed pointer and returns 0. + * If the thread has already been attached, the call succeeds and also provides + * the thread's isolate thread structure. + */ +typedef int (*graal_attach_thread_fn_t)(graal_isolate_t* isolate, graal_isolatethread_t** thread); + +/* + * Given an isolate to which the current thread is attached, returns the address of + * the thread's associated isolate thread structure. If the current thread is not + * attached to the passed isolate or if another error occurs, returns NULL. + */ +typedef graal_isolatethread_t* (*graal_get_current_thread_fn_t)(graal_isolate_t* isolate); + +/* + * Given an isolate thread structure, determines to which isolate it belongs and returns + * the address of its isolate structure. If an error occurs, returns NULL instead. + */ +typedef graal_isolate_t* (*graal_get_isolate_fn_t)(graal_isolatethread_t* thread); + +/* + * Detaches the passed isolate thread from its isolate and discards any state or + * context that is associated with it. At the time of the call, no code may still + * be executing in the isolate thread's context. + * Returns 0 on success, or a non-zero value on failure. + */ +typedef int (*graal_detach_thread_fn_t)(graal_isolatethread_t* thread); + +/* + * Using the context of the isolate thread from the first argument, detaches the + * threads in an array pointed to by the second argument, with the length of the + * array given in the third argument. All of the passed threads must be in the + * same isolate, including the first argument. None of the threads to detach may + * execute Java code at the time of the call or later without reattaching first, + * or their behavior will be entirely undefined. The current thread may be part of + * the array, however, using detach_thread() should be preferred for detaching only + * the current thread. + * Returns 0 on success, or a non-zero value on failure. + */ +typedef int (*graal_detach_threads_fn_t)(graal_isolatethread_t* thread, graal_isolatethread_t** array, int length); + +/* + * Tears down the passed isolate, waiting for any attached threads to detach from + * it, then discards the isolate's objects, threads, and any other state or context + * that is associated with it. + * Returns 0 on success, or a non-zero value on failure. + */ +typedef int (*graal_tear_down_isolate_fn_t)(graal_isolatethread_t* isolateThread); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/graalvm_artifacts/rocketmq-ons-cpp-full.h b/graalvm_artifacts/rocketmq-ons-cpp-full.h new file mode 100644 index 0000000..292a0e0 --- /dev/null +++ b/graalvm_artifacts/rocketmq-ons-cpp-full.h @@ -0,0 +1,44 @@ +#ifndef __ROCKETMQ_ONS_CPP_FULL_H +#define __ROCKETMQ_ONS_CPP_FULL_H + +#include <graal_isolate.h> + + +#if defined(__cplusplus) +extern "C" { +#endif + +int create_producer(graal_isolatethread_t*, factory_property*); + +int create_transaction_producer(graal_isolatethread_t*, factory_property*, void*, void *); + +int create_consumer(graal_isolatethread_t*, factory_property*); + +int create_order_consumer(graal_isolatethread_t*, factory_property*); + +void subscribe(graal_isolatethread_t*, int, subscription*); + +void subscribe_order_listener(graal_isolatethread_t*, int, subscription*); + +void start_instance(graal_isolatethread_t*, int); + +void destroy_instance(graal_isolatethread_t*, int); + +int create_order_producer(graal_isolatethread_t*, factory_property*); + +void send_message(graal_isolatethread_t*, int, message*, send_result*); + +void send_message_oneway(graal_isolatethread_t*, int, message*, send_result*); + +void send_message_async(graal_isolatethread_t*, int, message*, send_result*, callback_func*); + +void send_message_transaction(graal_isolatethread_t*, int, message*, send_result*, void*, void *); + +void send_order_message(graal_isolatethread_t*, int, message*, send_result*, char*); + +int run_main(int paramArgc, char** paramArgv); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/graalvm_artifacts/rocketmq-ons-cpp-full_dynamic.h b/graalvm_artifacts/rocketmq-ons-cpp-full_dynamic.h new file mode 100644 index 0000000..8f1c44f --- /dev/null +++ b/graalvm_artifacts/rocketmq-ons-cpp-full_dynamic.h @@ -0,0 +1,44 @@ +#ifndef __ROCKETMQ_ONS_CPP_FULL_H +#define __ROCKETMQ_ONS_CPP_FULL_H + +#include <graal_isolate_dynamic.h> + + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef int (*create_producer_fn_t)(graal_isolatethread_t*, factory_property*); + +typedef int (*create_transaction_producer_fn_t)(graal_isolatethread_t*, factory_property*, void*, void *); + +typedef int (*create_consumer_fn_t)(graal_isolatethread_t*, factory_property*); + +typedef int (*create_order_consumer_fn_t)(graal_isolatethread_t*, factory_property*); + +typedef void (*subscribe_fn_t)(graal_isolatethread_t*, int, subscription*); + +typedef void (*subscribe_order_listener_fn_t)(graal_isolatethread_t*, int, subscription*); + +typedef void (*start_instance_fn_t)(graal_isolatethread_t*, int); + +typedef void (*destroy_instance_fn_t)(graal_isolatethread_t*, int); + +typedef int (*create_order_producer_fn_t)(graal_isolatethread_t*, factory_property*); + +typedef void (*send_message_fn_t)(graal_isolatethread_t*, int, message*, send_result*); + +typedef void (*send_message_oneway_fn_t)(graal_isolatethread_t*, int, message*, send_result*); + +typedef void (*send_message_async_fn_t)(graal_isolatethread_t*, int, message*, send_result*, callback_func*); + +typedef void (*send_message_transaction_fn_t)(graal_isolatethread_t*, int, message*, send_result*, void*, void *); + +typedef void (*send_order_message_fn_t)(graal_isolatethread_t*, int, message*, send_result*, char*); + +typedef int (*run_main_fn_t)(int paramArgc, char** paramArgv); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/src/main/cpp/benchmark/ProducerBenchmark.cpp b/src/main/cpp/benchmark/ProducerBenchmark.cpp index ce73293..4300540 100644 --- a/src/main/cpp/benchmark/ProducerBenchmark.cpp +++ b/src/main/cpp/benchmark/ProducerBenchmark.cpp @@ -1,6 +1,6 @@ #include <benchmark/benchmark.h> #include "rocketmq.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include <cstring> static void BM_ProducerSendMessage(benchmark::State &state) { diff --git a/src/main/cpp/sdk/ConsumerImpl.cpp b/src/main/cpp/sdk/ConsumerImpl.cpp index 98e0d3b..1bf9459 100644 --- a/src/main/cpp/sdk/ConsumerImpl.cpp +++ b/src/main/cpp/sdk/ConsumerImpl.cpp @@ -1,7 +1,7 @@ #include "ConsumerImpl.h" #include "common/Logger.h" #include "common/UtilAll.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include "common/UtilAll.h" #include <iostream> diff --git a/src/main/cpp/sdk/OrderConsumerImpl.cpp b/src/main/cpp/sdk/OrderConsumerImpl.cpp index c2891be..8472895 100644 --- a/src/main/cpp/sdk/OrderConsumerImpl.cpp +++ b/src/main/cpp/sdk/OrderConsumerImpl.cpp @@ -1,6 +1,6 @@ #include "OrderConsumerImpl.h" #include "rocketmq.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include "common/Logger.h" #include "common/UtilAll.h" diff --git a/src/main/cpp/sdk/OrderProducerImpl.cpp b/src/main/cpp/sdk/OrderProducerImpl.cpp index 5f7e10a..4cb5ff5 100644 --- a/src/main/cpp/sdk/OrderProducerImpl.cpp +++ b/src/main/cpp/sdk/OrderProducerImpl.cpp @@ -1,6 +1,6 @@ #include "OrderProducerImpl.h" #include "rocketmq.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include <iostream> #include "SendResultONS.h" #include "Logger.h" diff --git a/src/main/cpp/sdk/ProducerImpl.cpp b/src/main/cpp/sdk/ProducerImpl.cpp index 809c907..1ce810a 100644 --- a/src/main/cpp/sdk/ProducerImpl.cpp +++ b/src/main/cpp/sdk/ProducerImpl.cpp @@ -1,6 +1,6 @@ #include "ProducerImpl.h" #include "rocketmq.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include "SendResultONS.h" #include "Logger.h" #include "common/UtilAll.h" diff --git a/src/main/cpp/sdk/TransactionProducerImpl.cpp b/src/main/cpp/sdk/TransactionProducerImpl.cpp index ca76e20..6f1051d 100644 --- a/src/main/cpp/sdk/TransactionProducerImpl.cpp +++ b/src/main/cpp/sdk/TransactionProducerImpl.cpp @@ -1,5 +1,5 @@ #include "TransactionProducerImpl.h" -#include "rocketmq-client-cpp-full.h" +#include "rocketmq-ons-cpp-full.h" #include "Logger.h" namespace ons {
