Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain-global-db
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-chain-global-db
Commits
e86d6194
Commit
e86d6194
authored
5 years ago
by
dmitriy.gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] Optional debug output
[*] Fixed mass save and delete
parent
a43fd14b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dap_chain_global_db.c
+1
-0
1 addition, 0 deletions
dap_chain_global_db.c
dap_chain_global_db_driver.c
+7
-5
7 additions, 5 deletions
dap_chain_global_db_driver.c
dap_chain_global_db_driver_cdb.c
+1
-0
1 addition, 0 deletions
dap_chain_global_db_driver_cdb.c
with
9 additions
and
5 deletions
dap_chain_global_db.c
+
1
−
0
View file @
e86d6194
...
...
@@ -543,6 +543,7 @@ bool dap_chain_global_db_gr_save(dap_global_db_obj_t* a_objs, size_t a_objs_coun
}
if
(
l_store_data
)
{
lock
();
//log_it(L_DEBUG,"Added %u objects", a_objs_count);
int
l_res
=
dap_chain_global_db_driver_add
(
l_store_data
,
a_objs_count
);
unlock
();
if
(
!
l_res
)
{
...
...
This diff is collapsed.
Click to expand it.
dap_chain_global_db_driver.c
+
7
−
5
View file @
e86d6194
...
...
@@ -381,7 +381,7 @@ static int save_write_buf(void)
assert
(
l_obj
);
if
(
s_drv_callback
.
apply_store_obj
)
{
if
(
!
s_drv_callback
.
apply_store_obj
(
l_obj
))
{
log_it
(
L_INFO
,
"Write item Ok %s/%s
\n
"
,
l_obj
->
group
,
l_obj
->
key
);
//
log_it(L_INFO, "Write item Ok %s/%s\n", l_obj->group, l_obj->key);
}
else
{
log_it
(
L_ERROR
,
"Can't write item %s/%s
\n
"
,
l_obj
->
group
,
l_obj
->
key
);
...
...
@@ -443,13 +443,13 @@ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store
pthread_mutex_lock
(
&
s_mutex_add_start
);
s_list_begin
=
s_list_end
;
pthread_mutex_unlock
(
&
s_mutex_add_start
);
//
printf("
*!!add record=0x%x / 0x%x obj=0x%x / 0x%x\n", s_list_end, s_list_end->data, s_list_end->prev);
//
log_it(L_DEBUG,"First record in list:
*!!add record=0x%x / 0x%x obj=0x%x / 0x%x\n", s_list_end, s_list_end->data, s_list_end->prev);
}
else
s_list_end
->
data
=
l_store_obj_cur
;
dap_list_append
(
s_list_end
,
NULL
);
s_list_end
=
dap_list_last
(
s_list_end
);
//
printf(
"**+add record l_cur=0x%x / 0x%x l_new=0x%x / 0x%x\n", s_list_end->prev, s_list_end->prev->data,s_list_end, s_list_end->data);
//
log_it(L_DEBUG,
"**+add record l_cur=0x%x / 0x%x l_new=0x%x / 0x%x\n", s_list_end->prev, s_list_end->prev->data,s_list_end, s_list_end->data);
}
// buffer changed
pthread_mutex_lock
(
&
s_mutex_cond
);
...
...
@@ -462,13 +462,15 @@ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store
int
dap_chain_global_db_driver_add
(
pdap_store_obj_t
a_store_obj
,
size_t
a_store_count
)
{
a_store_obj
->
type
=
'a'
;
for
(
size_t
i
=
0
;
i
<
a_store_count
;
i
++
)
a_store_obj
[
i
].
type
=
'a'
;
return
dap_chain_global_db_driver_appy
(
a_store_obj
,
a_store_count
);
}
int
dap_chain_global_db_driver_delete
(
pdap_store_obj_t
a_store_obj
,
size_t
a_store_count
)
{
a_store_obj
->
type
=
'd'
;
for
(
size_t
i
=
0
;
i
<
a_store_count
;
i
++
)
a_store_obj
[
i
].
type
=
'd'
;
return
dap_chain_global_db_driver_appy
(
a_store_obj
,
a_store_count
);
}
...
...
This diff is collapsed.
Click to expand it.
dap_chain_global_db_driver_cdb.c
+
1
−
0
View file @
e86d6194
...
...
@@ -355,6 +355,7 @@ int dap_db_driver_cdb_apply_store_obj(pdap_store_obj_t a_store_obj) {
dap_cdb_uint_to_hex
(
l_val
+
offset
,
l_time
,
sizeof
(
time_t
));
offset
+=
sizeof
(
time_t
);
l_rec
.
val
=
l_val
;
// log_it(L_DEBUG,"cbd_set() group: %s key: %s \tkey_size: %d\t val_size: %d",a_store_obj->group, l_rec.key, strlen(l_rec.key),offset);
cdb_set
(
l_cdb
,
l_rec
.
key
,
strlen
(
l_rec
.
key
),
l_rec
.
val
,
offset
);
DAP_DELETE
(
l_rec
.
key
);
DAP_DELETE
(
l_rec
.
val
);
...
...
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