OceanBase Plugin Development Kit
OceanBase Plugin Development Kit
载入中...
搜索中...
未找到
ob_plugin.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2023 OceanBase
3 * OceanBase is licensed under Mulan PubL v2.
4 * You can use this software according to the terms and conditions of the Mulan PubL v2.
5 * You may obtain a copy of Mulan PubL v2 at:
6 * http://license.coscl.org.cn/MulanPubL-2.0
7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10 * See the Mulan PubL v2 for more details.
11 */
12
13#pragma once
14
19
24/* @{ */
25
26#define OBP_AUTHOR_OCEANBASE "OceanBase Corporation"
27
32#define OBP_PLUGIN_API_VERSION OBP_MAKE_VERSION(0, 1, 0)
37#define OBP_PLUGIN_API_VERSION_CURRENT OBP_PLUGIN_API_VERSION
38
39#ifdef OBP_DYNAMIC_PLUGIN
41#define OBP_DECLARE_PLUGIN_(name) \
42 OBP_PLUGIN_EXPORT const char *OBP_DYNAMIC_PLUGIN_NAME_VAR = OBP_STRINGIZE(name); \
43 OBP_PLUGIN_EXPORT int64_t OBP_DYNAMIC_PLUGIN_API_VERSION_VAR = OBP_PLUGIN_API_VERSION_CURRENT; \
44 OBP_PLUGIN_EXPORT const char *OBP_DYNAMIC_PLUGIN_BUILD_REVISION_VAR = OBP_BUILD_REVISION; \
45 OBP_PLUGIN_EXPORT const char *OBP_DYNAMIC_PLUGIN_BUILD_BRANCH_VAR = OBP_BUILD_BRANCH; \
46 OBP_PLUGIN_EXPORT const char *OBP_DYNAMIC_PLUGIN_BUILD_DATE_VAR = OBP_BUILD_DATE; \
47 OBP_PLUGIN_EXPORT const char *OBP_DYNAMIC_PLUGIN_BUILD_TIME_VAR = OBP_BUILD_TIME; \
48 OBP_PLUGIN_EXPORT int64_t OBP_DYNAMIC_PLUGIN_SIZEOF_VAR = sizeof(struct _ObPlugin); \
49 OBP_PLUGIN_EXPORT ObPlugin OBP_DYNAMIC_PLUGIN_PLUGIN_VAR =
50
51#else /* OBP_DYNAMIC_PLUGIN */
52
54#define OBP_DECLARE_PLUGIN_(name) \
55 OBP_PLUGIN_EXPORT ObPlugin OBP_BUILTIN_PLUGIN_VAR(name) =
56
57#endif /* OBP_DYNAMIC_PLUGIN */
58
74#define OBP_DECLARE_PLUGIN(name) \
75 OBP_DECLARE_PLUGIN_(name)
76
81#define OBP_DECLARE_PLUGIN_END
82
84#ifdef __cplusplus
85extern "C" {
86#endif
87
92
103
108#define OBP_LICENSE_GPL "GPL"
109#define OBP_LICENSE_BSD "BSD"
110#define OBP_LICENSE_MIT "MIT"
111#define OBP_LICENSE_APACHE_V2 "Apache 2.0"
112#define OBP_LICENSE_MULAN_PUBL_V2 "Mulan PubL v2"
113#define OBP_LICENSE_MULAN_PSL_V2 "Mulan PSL v2"
114
124typedef uint64_t ObPluginVersion;
125
127#define OBP_MAKE_VERSION(major, minor, patch) \
128 ((major) * OBP_VERSION_FIELD_NUMBER * OBP_VERSION_FIELD_NUMBER + (minor) * OBP_VERSION_FIELD_NUMBER + (patch))
129
136{
137 const char * author;
139 const char * license;
145 int (*init) (ObPluginParamPtr param);
146
151 int (*deinit)(ObPluginParamPtr param);
152};
153
154typedef struct _ObPlugin ObPlugin;
155
160
166
171
172#ifdef __cplusplus
173} // extern "C"
174#endif
175
176/* @} */
OBP_PUBLIC_API ObPlugin * obp_param_plugin(ObPluginParamPtr param)
get the struct ObPlugin from the parameter
OBP_PLUGIN_TYPE_INVALID
OBP_PUBLIC_API ObPluginDatum obp_param_plugin_user_data(ObPluginParamPtr param)
get the plugin instance specific(user data) from the parameter
enum OBP_PUBLIC_API ObPluginType
Plugin types
OBP_PLUGIN_TYPE_MAX
external table data resource
OBP_PLUGIN_TYPE_EXTERNAL
OBP_PUBLIC_API void obp_param_set_plugin_user_data(ObPluginParamPtr param, ObPluginDatum plugin_spec)
set the plugin instance specific(user data) in the parameter
uint64_t ObPluginVersion
The version type
ObPluginDatum ObPluginParamPtr
@NOTE all API should be declared as C interface
OBP_PLUGIN_TYPE_FT_PARSER
fulltext parser plugin
#define OBP_PUBLIC_API
void * ObPluginDatum
Used for param type
ob plugin description structure
const char * license
The license of the plugin.
ObPluginVersion version
library version for the plugin
const char * author