Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
16
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
cellframe-sdk
Commits
7b731571
Commit
7b731571
authored
2 weeks ago
by
pavel.uhanov
Browse files
Options
Downloads
Patches
Plain Diff
[*] add cluster formig
parent
a9f7f1d9
No related branches found
No related tags found
1 merge request
!2120
Draft: feature-15728
Pipeline
#52083
passed with stage
in 12 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/net/dap_chain_net_balancer.c
+2
-2
2 additions, 2 deletions
modules/net/dap_chain_net_balancer.c
modules/net/dap_chain_node_rpc.c
+12
-3
12 additions, 3 deletions
modules/net/dap_chain_node_rpc.c
with
14 additions
and
5 deletions
modules/net/dap_chain_net_balancer.c
+
2
−
2
View file @
7b731571
...
...
@@ -55,8 +55,8 @@ static_assert(sizeof(dap_chain_net_links_t) + sizeof(dap_chain_node_info_old_t)
static
const
size_t
s_max_links_response_count
=
(
DAP_BALANCER_MAX_REPLY_SIZE
-
sizeof
(
dap_chain_net_links_t
))
/
sizeof
(
dap_chain_node_info_old_t
);
static
dap_balancer_request_info_t
*
s_request_info_items
=
NULL
;
static
bool
s_balancer_node
=
fals
e
;
static
bool
s_balancer_rpc
=
fals
e
;
static
bool
s_balancer_node
=
tru
e
;
static
bool
s_balancer_rpc
=
tru
e
;
const
char
*
s_uri
[]
=
{
"f0intlt4eyl03htogu"
,
...
...
This diff is collapsed.
Click to expand it.
modules/net/dap_chain_node_rpc.c
+
12
−
3
View file @
7b731571
...
...
@@ -47,17 +47,21 @@
#include
"dap_chain_ledger.h"
#define LOG_TAG "dap_chain_node_rpc"
#define DAP_RPC_CLUSTER_GLOBAL ".rpc"
#define DAP_RPC_DB_CLUSTER_GLOBAL DAP_RPC_CLUSTER_GLOBAL ".*"
#define DAP_CHAIN_NODE_RPC_STATES_INFO_CURRENT_VERSION 1
typedef
struct
dap_chain_node_rpc_states_info
{
uint32_t
version
;
dap_chain_node_addr_t
address
;
int32_t
net_state
;
uint32_t
cli_thread_count
;
uint32_t
cpu
;
uint64_t
mem
;
}
DAP_ALIGN_PACKED
dap_chain_node_rpc_states_info_t
;
static
const
uint64_t
s_timer_update_states_info
=
10
/*sec*/
*
1000
;
static
const
char
s_states_group
[]
=
".rpc.states"
;
static
dap_global_db_cluster_t
*
s_global_cluster
=
NULL
;
/**
* @brief get states info about current
...
...
@@ -66,7 +70,7 @@ static const char s_states_group[] = ".rpc.states";
static
void
s_update_node_rpc_states_info
(
UNUSED_ARG
void
*
a_arg
)
{
for
(
dap_chain_net_t
*
l_net
=
dap_chain_net_iter_start
();
l_net
;
l_net
=
dap_chain_net_iter_next
(
l_net
))
{
if
(
dap_chain_net_get_state
(
l_net
)
!
=
NET_STATE_O
FF
LINE
)
{
if
(
dap_chain_net_get_state
(
l_net
)
=
=
NET_STATE_O
N
LINE
)
{
size_t
l_uplinks_count
=
0
,
l_downlinks_count
=
0
,
...
...
@@ -74,7 +78,6 @@ static void s_update_node_rpc_states_info(UNUSED_ARG void *a_arg)
dap_chain_node_rpc_states_info_t
*
l_info
=
DAP_NEW_Z_RET_IF_FAIL
(
dap_chain_node_rpc_states_info_t
);
l_info
->
version
=
DAP_CHAIN_NODE_RPC_STATES_INFO_CURRENT_VERSION
;
l_info
->
address
.
uint64
=
g_node_addr
.
uint64
;
l_info
->
net_state
=
dap_chain_net_get_state
(
l_net
);
char
*
l_gdb_group
=
dap_strdup_printf
(
"%s%s"
,
l_net
->
pub
.
gdb_groups_prefix
,
s_states_group
);
const
char
*
l_node_addr_str
=
dap_stream_node_addr_to_str_static
(
l_info
->
address
);
...
...
@@ -140,6 +143,12 @@ static void s_states_info_to_str(dap_chain_net_t *a_net, const char *a_node_addr
void
dap_chain_node_rpc_init
()
{
if
(
!
(
s_global_cluster
=
dap_global_db_cluster_add
(
dap_global_db_instance_get_default
(),
DAP_RPC_CLUSTER_GLOBAL
,
*
(
dap_guuid_t
*
)
&
uint128_0
,
DAP_RPC_DB_CLUSTER_GLOBAL
,
0
,
true
,
DAP_GDB_MEMBER_ROLE_GUEST
,
DAP_CLUSTER_TYPE_VIRTUAL
)))
return
;
if
(
dap_proc_thread_timer_add
(
NULL
,
s_update_node_rpc_states_info
,
NULL
,
s_timer_update_states_info
))
log_it
(
L_ERROR
,
"Can't activate timer on node states update"
);
}
...
...
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