Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Commits
39f953ce
Commit
39f953ce
authored
4 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[*] Fixed in handler command plugins restart and plugins show.
parent
2f8833ed
No related branches found
No related tags found
1 merge request
!27
Support update sdk and merge plugins repo
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/dap_chain_plugins_command.h
+1
-0
1 addition, 0 deletions
include/dap_chain_plugins_command.h
src/dap_chain_plugins_command.c
+42
-10
42 additions, 10 deletions
src/dap_chain_plugins_command.c
src/dap_chain_plugins_manifest.c
+14
-16
14 additions, 16 deletions
src/dap_chain_plugins_manifest.c
with
57 additions
and
26 deletions
include/dap_chain_plugins_command.h
+
1
−
0
View file @
39f953ce
...
...
@@ -12,6 +12,7 @@ extern "C" {
void
dap_chain_plugins_command_create
(
void
);
int
dap_chain_plugins_command_handler
(
int
a_argc
,
char
**
a_argv
,
void
*
a_arg_func
,
char
**
a_str_reply
);
//char *dap_chain_plugins_command_table();
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
src/dap_chain_plugins_command.c
+
42
−
10
View file @
39f953ce
...
...
@@ -14,6 +14,8 @@ void dap_chain_plugins_command_create(void){
}
}
int
dap_chain_plugins_command_handler
(
int
a_argc
,
char
**
a_argv
,
void
*
a_arg_func
,
char
**
a_str_reply
){
(
void
)
a_arg_func
;
log_it
(
L_NOTICE
,
"Handler cmd"
);
enum
{
CMD_NONE
,
CMD_LIST
,
CMD_SHOW_NAME
,
CMD_RESTART
,
CMD_RELOAD_NAME
};
...
...
@@ -29,25 +31,33 @@ int dap_chain_plugins_command_handler(int a_argc, char **a_argv, void *a_arg_fun
cmd_name
=
CMD_RESTART
;
if
(
dap_chain_node_cli_find_option_val
(
a_argv
,
arg_index
,
a_argc
,
"reload"
,
NULL
))
cmd_name
=
CMD_RELOAD_NAME
;
char
*
str
=
NULL
;
switch
(
cmd_name
)
{
case
CMD_LIST
:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"|
\t
Name plugin
\t
|
\t
Version
\t
|
\t
Author(s)
\t
|"
);
str
=
dap_strdup
(
"|
\t
Name plugin
\t
|
\t
Version
\t
|
\t
Author(s)
\t
|
\n
"
);
LL_FOREACH
(
dap_chain_plugins_manifests_get_list
(),
element
){
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"|
\t
%s
\t
|
\t
%s
\t
|
\t
%s
\t
|"
,
element
->
name
,
element
->
version
,
element
->
author
);
str
=
dap_strjoin
(
NULL
,
str
,
"|
\t
"
,
element
->
name
,
"
\t
|
\t
"
,
element
->
version
,
"
\t
|
\t
"
,
element
->
author
,
"
\t
|
\n
"
,
NULL
);
}
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
str
);
break
;
case
CMD_SHOW_NAME
:
dap_chain_node_cli_find_option_val
(
a_argv
,
arg_index
,
a_argc
,
"--name"
,
&
name_plugin
);
log_it
(
L_NOTICE
,
"name plugin: %s"
,
name_plugin
);
LL_SEARCH
(
dap_chain_plugins_manifests_get_list
(),
element
,
name_plugin
,
dap_chain_plugins_manifest_name_cmp
);
if
(
element
!=
NULL
){
char
*
dep
=
dap_chain_plugins_manifests_get_list_dependencyes
(
element
);
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Name: %s
\n
Version: %s
\n
Author: %s"
"Description: %s
\n
Dependencys: %s
\n\n
"
,
element
->
name
,
element
->
version
,
element
->
author
,
element
->
dependencys
,
dep
);
DAP_FREE
(
dep
);
if
(
dep
!=
NULL
){
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
" Name: %s
\n
Version: %s
\n
Author: %s
\n
"
" Description: %s
\n
Dependencys: %s
\n\n
"
,
element
->
name
,
element
->
version
,
element
->
author
,
element
->
description
,
dep
);
DAP_FREE
(
dep
);
}
else
{
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
" Name: %s
\n
Version: %s
\n
Author: %s
\n
"
" Description: %s
\n\n
"
,
element
->
name
,
element
->
version
,
element
->
author
,
element
->
description
);
}
}
else
{
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Can't searching plugin with name %s"
,
name_plugin
);
}
...
...
@@ -55,10 +65,32 @@ int dap_chain_plugins_command_handler(int a_argc, char **a_argv, void *a_arg_fun
case
CMD_RESTART
:
log_it
(
L_NOTICE
,
"Start procedure restart python plugins module"
);
dap_chain_plugins_deinit
();
dap_chain_plugins_init
();
dap_chain_plugins_init
(
g_config
);
log_it
(
L_NOTICE
,
"Done procedure restart python plugins module"
);
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Done procedure restart python plugins module."
);
break
;
case
CMD_RELOAD_NAME
:
dap_chain_node_cli_find_option_val
(
a_argv
,
arg_index
,
a_argc
,
"--name"
,
&
name_plugin
);
int
result
=
dap_chain_plugins_reload_plugin
(
name_plugin
);
switch
(
result
)
{
case
0
:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Restarting the plugin %s completed successfully."
,
name_plugin
);
break
;
case
-
2
:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"%s plugin has unresolved dependencys, restart all plagins"
,
name_plugin
);
break
;
case
-
3
:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Registration %s manifest for %s plugin fail"
,
name_plugin
);
break
;
case
-
4
:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"A plugin named %s will not find"
,
name_plugin
);
break
;
default:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"An unforeseen error has occurred."
);
break
;
}
break
;
default:
dap_chain_node_cli_set_reply_text
(
a_str_reply
,
"Not validation parameters"
);
...
...
This diff is collapsed.
Click to expand it.
src/dap_chain_plugins_manifest.c
+
14
−
16
View file @
39f953ce
...
...
@@ -95,24 +95,22 @@ dap_chain_plugins_list_manifest_t *dap_chain_plugins_manifest_list_get_name(cons
}
char
*
dap_chain_plugins_manifests_get_list_dependencyes
(
dap_chain_plugins_list_manifest_t
*
element
){
char
*
result
=
NULL
;
dap_chain_plugins_list_char_t
*
e1
;
LL_FOREACH
(
element
->
dependencys
,
e1
){
char
*
new_result
=
dap_strjoin
(
NULL
,
result
,
e1
->
value
,
", "
);
DAP_FREE
(
result
);
result
=
new_result
;
}
if
(
result
!=
NULL
){
size_t
size_result
=
dap_strlen
(
result
);
size_t
new_size_result
=
size_result
-
2
;
char
*
new_result
=
DAP_NEW_SIZE
(
char
,
new_size_result
);
memcpy
(
new_result
,
result
,
new_size_result
);
DAP_FREE
(
result
);
result
=
new_result
;
if
(
element
->
dependencys
==
NULL
)
{
return
NULL
;
}
else
{
result
=
""
;
char
*
result
=
""
;
dap_chain_plugins_list_char_t
*
el
;
int
max_count_list
=
0
;
LL_COUNT
(
element
->
dependencys
,
el
,
max_count_list
);
int
count_list
=
1
;
LL_FOREACH
(
element
->
dependencys
,
el
){
if
(
count_list
!=
max_count_list
)
result
=
dap_strjoin
(
NULL
,
result
,
el
->
value
,
", "
,
NULL
);
else
result
=
dap_strjoin
(
NULL
,
result
,
el
->
value
,
NULL
);
}
return
result
;
}
return
result
;
}
bool
dap_chain_plugins_manifest_list_add_from_file
(
const
char
*
file_path
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment