mirror of
https://github.com/emqx/neuron.git
synced 2026-10-28 14:07:20 +08:00
Merge pull request #1687 from ZhouBox/main
feat(api):add version when get plugins info
This commit is contained in:
@@ -305,6 +305,7 @@ typedef struct neu_resp_plugin_info {
|
||||
|
||||
neu_plugin_kind_e kind;
|
||||
neu_node_type_e type;
|
||||
uint32_t version;
|
||||
|
||||
bool single;
|
||||
bool display;
|
||||
|
||||
@@ -143,6 +143,11 @@ void handle_get_plugin_resp(nng_aio *aio, neu_resp_get_plugin_t *plugins)
|
||||
plugin_res.plugin_libs[index].description = (char *) info->description;
|
||||
plugin_res.plugin_libs[index].description_zh =
|
||||
(char *) info->description_zh;
|
||||
snprintf(plugin_res.plugin_libs[index].version,
|
||||
sizeof(plugin_res.plugin_libs[index].version), "%d.%d.%d",
|
||||
NEU_GET_VERSION_MAJOR(info->version),
|
||||
NEU_GET_VERSION_MINOR(info->version),
|
||||
NEU_GET_VERSION_FIX(info->version));
|
||||
}
|
||||
|
||||
neu_json_encode_by_fn(&plugin_res, neu_json_encode_get_plugin_resp,
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef struct plugin_entity {
|
||||
|
||||
neu_plugin_kind_e kind;
|
||||
neu_node_type_e type;
|
||||
uint32_t version;
|
||||
|
||||
bool display;
|
||||
|
||||
@@ -149,6 +150,7 @@ int neu_plugin_manager_add(neu_plugin_manager_t *mgr,
|
||||
}
|
||||
plugin = calloc(1, sizeof(plugin_entity_t));
|
||||
|
||||
plugin->version = pm->version;
|
||||
plugin->display = pm->display;
|
||||
plugin->type = pm->type;
|
||||
plugin->kind = pm->kind;
|
||||
@@ -201,8 +203,9 @@ UT_array *neu_plugin_manager_get(neu_plugin_manager_t *mgr)
|
||||
continue;
|
||||
}
|
||||
neu_resp_plugin_info_t info = {
|
||||
.kind = el->kind,
|
||||
.type = el->type,
|
||||
.kind = el->kind,
|
||||
.type = el->type,
|
||||
.version = el->version,
|
||||
};
|
||||
|
||||
info.display = el->display;
|
||||
|
||||
@@ -175,6 +175,11 @@ int neu_json_encode_get_plugin_resp(void *json_object, void *param)
|
||||
.t = NEU_JSON_INT,
|
||||
.v.val_int = p_plugin_lib->kind,
|
||||
},
|
||||
{
|
||||
.name = "version",
|
||||
.t = NEU_JSON_STR,
|
||||
.v.val_str = p_plugin_lib->version,
|
||||
},
|
||||
};
|
||||
plugin_lib_array =
|
||||
neu_json_encode_array(plugin_lib_array, plugin_lib_elems,
|
||||
|
||||
@@ -52,6 +52,7 @@ int neu_json_decode_del_plugin_req(char * buf,
|
||||
void neu_json_decode_del_plugin_req_free(neu_json_del_plugin_req_t *req);
|
||||
|
||||
typedef struct {
|
||||
char version[32];
|
||||
char * name;
|
||||
char * schema;
|
||||
char * library;
|
||||
|
||||
Reference in New Issue
Block a user