@@ -70,25 +70,24 @@ fn main() {
70
70
let db_destination = create_empty_db ( path_destination. clone ( ) ) ;
71
71
72
72
println ! ( "\n ######### root_hashes:" ) ;
73
- let root_hash_0 = db_source. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
74
- println ! ( "root_hash_0 : {:?}" , hex:: encode( root_hash_0 ) ) ;
73
+ let root_hash_source = db_source. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
74
+ println ! ( "root_hash_source : {:?}" , hex:: encode( root_hash_source ) ) ;
75
75
let root_hash_checkpoint_0 = db_checkpoint_0. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
76
76
println ! ( "root_hash_checkpoint_0: {:?}" , hex:: encode( root_hash_checkpoint_0) ) ;
77
- let root_hash_copy = db_destination. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
78
- println ! ( "root_hash_copy : {:?}" , hex:: encode( root_hash_copy ) ) ;
77
+ let root_hash_destination = db_destination. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
78
+ println ! ( "root_hash_destination : {:?}" , hex:: encode( root_hash_destination ) ) ;
79
79
80
- println ! ( "\n ######### source_subtree_metadata" ) ;
81
- let subtrees_metadata = db_source. get_subtrees_metadata ( None ) . unwrap ( ) ;
82
- println ! ( "{:?}" , subtrees_metadata ) ;
80
+ println ! ( "\n ######### source_subtree_metadata of db_source " ) ;
81
+ let subtrees_metadata_source = db_source. get_subtrees_metadata ( None ) . unwrap ( ) ;
82
+ println ! ( "{:?}" , subtrees_metadata_source ) ;
83
83
84
- println ! ( "\n ######### db_checkpoint_0 -> db_copy state sync" ) ;
84
+ println ! ( "\n ######### db_checkpoint_0 -> db_destination state sync" ) ;
85
85
let state_info = db_destination. create_state_sync_info ( ) ;
86
- let source_tx = db_source. start_transaction ( ) ;
87
- let target_tx = db_destination. start_transaction ( ) ;
88
- sync_db_demo ( & db_checkpoint_0, & db_destination, state_info, & source_tx, & target_tx) . unwrap ( ) ;
89
- db_destination. commit_transaction ( target_tx) . unwrap ( ) . expect ( "expected to commit transaction" ) ;
86
+ let tx = db_destination. start_transaction ( ) ;
87
+ sync_db_demo ( & db_checkpoint_0, & db_destination, state_info, & tx) . unwrap ( ) ;
88
+ db_destination. commit_transaction ( tx) . unwrap ( ) . expect ( "expected to commit transaction" ) ;
90
89
91
- println ! ( "\n ######### verify db_copy " ) ;
90
+ println ! ( "\n ######### verify db_destination " ) ;
92
91
let incorrect_hashes = db_destination. verify_grovedb ( None ) . unwrap ( ) ;
93
92
if incorrect_hashes. len ( ) > 0 {
94
93
println ! ( "DB verification failed!" ) ;
@@ -98,18 +97,18 @@ fn main() {
98
97
}
99
98
100
99
println ! ( "\n ######### root_hashes:" ) ;
101
- let root_hash_0 = db_source. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
102
- println ! ( "root_hash_0 : {:?}" , hex:: encode( root_hash_0 ) ) ;
100
+ let root_hash_source = db_source. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
101
+ println ! ( "root_hash_source : {:?}" , hex:: encode( root_hash_source ) ) ;
103
102
let root_hash_checkpoint_0 = db_checkpoint_0. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
104
103
println ! ( "root_hash_checkpoint_0: {:?}" , hex:: encode( root_hash_checkpoint_0) ) ;
105
- let root_hash_copy = db_destination. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
106
- println ! ( "root_hash_copy : {:?}" , hex:: encode( root_hash_copy ) ) ;
104
+ let root_hash_destination = db_destination. root_hash ( None ) . unwrap ( ) . unwrap ( ) ;
105
+ println ! ( "root_hash_destination : {:?}" , hex:: encode( root_hash_destination ) ) ;
107
106
108
107
let query_path = & [ MAIN_ΚΕΥ , KEY_INT_0 ] ;
109
108
let query_key = ( 20487u32 ) . to_be_bytes ( ) . to_vec ( ) ;
110
109
println ! ( "\n ######## Query on db_checkpoint_0:" ) ;
111
110
query_db ( & db_checkpoint_0, query_path, query_key. clone ( ) ) ;
112
- println ! ( "\n ######## Query on db_copy :" ) ;
111
+ println ! ( "\n ######## Query on db_destination :" ) ;
113
112
query_db ( & db_destination, query_path, query_key. clone ( ) ) ;
114
113
115
114
return ;
@@ -224,7 +223,6 @@ fn sync_db_demo(
224
223
source_db : & GroveDb ,
225
224
target_db : & GroveDb ,
226
225
state_sync_info : StateSyncInfo ,
227
- source_tx : & Transaction ,
228
226
target_tx : & Transaction ,
229
227
) -> Result < ( ) , grovedb:: Error > {
230
228
let app_hash = source_db. root_hash ( None ) . value . unwrap ( ) ;
@@ -235,7 +233,7 @@ fn sync_db_demo(
235
233
chunk_queue. extend ( chunk_ids) ;
236
234
237
235
while let Some ( chunk_id) = chunk_queue. pop_front ( ) {
238
- let ops = source_db. fetch_chunk ( chunk_id. as_slice ( ) , source_tx ) ?;
236
+ let ops = source_db. fetch_chunk ( chunk_id. as_slice ( ) , None ) ?;
239
237
let ( more_chunks, new_state_sync_info) = target_db. apply_chunk ( state_sync_info, ( chunk_id. as_slice ( ) , ops) , target_tx) ?;
240
238
state_sync_info = new_state_sync_info;
241
239
chunk_queue. extend ( more_chunks) ;
0 commit comments