-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathfurther-build-optimizations.txt
More file actions
1411 lines (1265 loc) · 61.7 KB
/
Copy pathfurther-build-optimizations.txt
File metadata and controls
1411 lines (1265 loc) · 61.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
╭─── Claude Code v2.0.62 ──────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back vogel! │ Run /init to create a CLAUDE.md file with instr… │
│ │ ──────────────────────────────────────────────── │
│ ▐▛███▜▌ │ Recent activity │
│ ▝▜█████▛▘ │ No recent activity │
│ ▘▘ ▝▝ │ │
│ │ │
│ Opus 4.5 · Claude Max │ │
│ /storage1/src/hive │ │
╰──────────────────────────────────────────────────────────────────────────────╯
══════════════════ Conversation compacted · ctrl+o for history ═════════════════
⎿ Read libraries/chain/include/hive/chain/index.hpp (66 lines)
⎿ Referenced file libraries/chain/database_init.cpp
⎿ Referenced file libraries/chain/include/hive/chain/database.hpp
⎿ Read libraries/chain/database_impl.hpp (134 lines)
⎿ Read libraries/utilities/include/hive/utilities/signal.hpp (25 lines)
● Let me check how chain_plugin.cpp uses the reindex signals to fix the
build errors.
● Read(libraries/plugins/chain/chain_plugin.cpp)
⎿ Read 50 lines
● I can see that chain_plugin.cpp is directly calling the reindex signals
via HIVE_TRY_NOTIFY macro. I need to add public accessor methods for these
signals in the database class. Let me check what other signals might be
accessed externally, and then add appropriate public methods.
● Search(pattern: "db\._\w+_signal", path: "libraries/plugins", output_mode:
"content")
⎿ Found 2 lines (ctrl+o to expand)
● Only the reindex signals are accessed externally. I need to add public
methods to trigger these signals. Let me check the database.hpp to see the
current notify methods pattern:
● Read(libraries/chain/include/hive/chain/database.hpp)
⎿ Read 100 lines
● Search(pattern: "notify_pre_reindex|notify_post_reindex", path:
"libraries/chain", output_mode: "content")
⎿ Found 0 lines
● There are no existing notify methods for reindex signals. I need to add
them. Let me search for how notify methods are declared:
● Search(pattern: "void notify_", path:
"libraries/chain/include/hive/chain/database.hpp", output_mode:
"content")
⎿ Found 18 lines (ctrl+o to expand)
● I need to add notify_pre_reindex and notify_post_reindex methods. Let me
add them to database.hpp:
● Read(libraries/chain/include/hive/chain/database.hpp)
⎿ Read 20 lines
● Update(libraries/chain/include/hive/chain/database.hpp)
⎿ Updated libraries/chain/include/hive/chain/database.hpp with 2
additions
385 void notify_comment_reward(const
comment_reward_notification& note);
386 void notify_end_of_syncing();
387 void notify_wipe();
388 + void notify_pre_reindex(const reindex_notification&
+ note);
389 + void notify_post_reindex(const reindex_notification&
+ note);
390
391 public:
392
● Now let me add the implementations to database.cpp. First, let me find the
other notify implementations:
● Search(pattern: "void database::notify_wipe", path:
"libraries/chain/database.cpp", output_mode: "content")
⎿ Found 1 line (ctrl+o to expand)
● Read(libraries/chain/database.cpp)
⎿ Read 20 lines
● Update(libraries/chain/database.cpp)
⎿ Updated libraries/chain/database.cpp with 10 additions
875 HIVE_TRY_NOTIFY( _my->_flush_signal )
876 }
877
878 + void database::notify_pre_reindex( const
+ reindex_notification& note )
879 + {
880 + HIVE_TRY_NOTIFY( _my->_pre_reindex_signal, note )
881 + }
882 +
883 + void database::notify_post_reindex( const
+ reindex_notification& note )
884 + {
885 + HIVE_TRY_NOTIFY( _my->_post_reindex_signal, note )
886 + }
887 +
888 account_name_type database::get_scheduled_witness( uint32_t
slot_num )const
889 {
890 const dynamic_global_property_object& dpo =
get_dynamic_global_properties();
● Now let me update chain_plugin.cpp to use the notify methods:
● Update(libraries/plugins/chain/chain_plugin.cpp)
⎿ Updated libraries/plugins/chain/chain_plugin.cpp with 1 addition and 1
removal
1111 reindex_notification note( args );
1112
1113 BOOST_SCOPE_EXIT(this_,¬e) {
1114 - HIVE_TRY_NOTIFY(this_->db._post_reindex_signal, note);
1114 + this_->db.notify_post_reindex(note);
1115 } BOOST_SCOPE_EXIT_END
1116
1117 try
● Update(libraries/plugins/chain/chain_plugin.cpp)
⎿ Updated libraries/plugins/chain/chain_plugin.cpp with 1 addition and 1
removal
1138 note.force_replay = args.force_replay ||
_head_block_num == 0;
1139 note.validate_during_replay =
args.validate_during_replay;
1140
1141 - HIVE_TRY_NOTIFY(db._pre_reindex_signal, note);
1141 + db.notify_pre_reindex(note);
1142
1143 default_block_writer->on_reindex_start();
1144
● Now let me build to verify the changes:
● Bash(ninja -j$(nproc) hived 2>&1 | head -200) timeout: 5m 0s
⎿ Error: Exit code 2
/bin/bash: eval: line 1: syntax error near unexpected token `('
/bin/bash: eval: line 1: `ninja -j\$ ( nproc ) hived 2>&1 < /dev/null | head
-200'
● Bash(ninja -j8 hived 2>&1 | head -200) timeout: 5m 0s
⎿ [1/135] Performing build step for 'project_secp256k1'
make all-am
make[1]: Entering directory '/storage1/src/hive/build/libraries/fc/vend
… +365 lines (ctrl+o to expand)
● The build succeeded. Let me update the todo list and commit the changes:
● Bash(cd /storage1/src/hive && git status)
⎿ On branch optimize-block-api-compilation
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
… +9 lines (ctrl+o to expand)
● Bash(git diff --stat)
⎿ libraries/chain/database.cpp | 48 ++++++----
libraries/chain/database_impl.hpp | 94 ++++++++++++++++
+++
… +6 lines (ctrl+o to expand)
● Bash(git log --oneline -5)
⎿ 5f754607f Add signal_connection_ptr type and update signal.hpp
9673dd2ae Convert connect_impl and any_apply_operation_handler_impl to
local functions
… +4 lines (ctrl+o to expand)
● Bash(git add libraries/chain/database.cpp libraries/chain/database_impl.hpp
libraries/chain/database_init.cpp
libraries/chain/include/hive/chain/database.hpp librari…)
⎿ [optimize-block-api-compilation 0d7463342] Move fc::signal members from
database class to database_impl
6 files changed, 159 insertions(+), 153 deletions(-)
● Successfully moved all fc::signal members from the database class to
database_impl. The changes include:
1. database_impl.hpp: Added all 20+ signal members with their original
documentation comments
2. database.cpp: Updated all notify_* methods to access signals through
_my-> prefix
3. database_init.cpp: Updated all add_*_handler methods to use _my->
prefix
4. database.hpp: Removed signal members, added
notify_pre_reindex/notify_post_reindex and add_plugin_index_handler public
methods
5. index.hpp: Updated to use add_plugin_index_handler instead of friend
function
6. chain_plugin.cpp: Updated to use notify methods instead of direct
signal access
The build succeeded and changes have been committed as 0d7463342.
> now change all database class methods returning
boost::signals2::connection to return signal_connection_ptr
● I'll change all database class methods that return
boost::signals2::connection to return signal_connection_ptr instead.
● Search(pattern: "boost::signals2::connection", path:
"libraries/chain/include/hive/chain/database.hpp", output_mode:
"content")
⎿ Found 22 lines (ctrl+o to expand)
● Read(libraries/chain/include/hive/chain/database.hpp)
⎿ Read 55 lines
● I need to check the signal_connection_ptr type definition to understand
how it's used:
● Read(libraries/utilities/include/hive/utilities/signal_connection_ptr.hpp)
⎿ Read 14 lines
● Now let me update database.hpp to replace all boost::signals2::connection
return types with hive::utilities::signal_connection_ptr:
● Update(libraries/chain/include/hive/chain/database.hpp)
⎿ Updated libraries/chain/include/hive/chain/database.hpp with 24
additions and 22 removals
390
391 public:
392
393 - boost::signals2::connection
- add_pre_apply_operation_handler ( const
- apply_operation_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
394 - boost::signals2::connection
- add_post_apply_operation_handler ( const
- apply_operation_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
395 - boost::signals2::connection
- add_pre_apply_transaction_handler ( const
- apply_transaction_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
396 - boost::signals2::connection
- add_post_apply_transaction_handler ( const
- apply_transaction_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
397 - boost::signals2::connection
- add_pre_apply_block_handler ( const
- apply_block_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
398 - boost::signals2::connection
- add_post_apply_block_handler ( const
- apply_block_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
399 - boost::signals2::connection
- add_fail_apply_block_handler ( const
- apply_block_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
400 - boost::signals2::connection
- add_irreversible_block_handler ( const
- irreversible_block_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
401 - boost::signals2::connection add_switch_fork_handler
- ( const switch_fork_handler_t& func,
- const abstract_plugin& plugin, int32_t group = -1 );
402 - boost::signals2::connection add_pre_reindex_handler
- ( const reindex_handler_t&
- func, const abstract_plugin& plugin, int32_t group = -1 );
403 - boost::signals2::connection add_post_reindex_handler
- ( const reindex_handler_t&
- func, const abstract_plugin& plugin, int32_t group = -1 );
404 - boost::signals2::connection
- add_pre_apply_custom_operation_handler ( const
- apply_custom_operation_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
405 - boost::signals2::connection
- add_post_apply_custom_operation_handler( const
- apply_custom_operation_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
406 - boost::signals2::connection
- add_finish_push_block_handler ( const
- push_block_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1 );
393 + using signal_connection_ptr =
+ hive::utilities::signal_connection_ptr;
394
395 - boost::signals2::connection
- add_prepare_snapshot_handler (const
- prepare_snapshot_handler_t& func, const abstract_plugin&
- plugin, int32_t group = -1);
395 + signal_connection_ptr add_pre_apply_operation_handler
+ ( const apply_operation_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
396 + signal_connection_ptr
+ add_post_apply_operation_handler ( const
+ apply_operation_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
397 + signal_connection_ptr
+ add_pre_apply_transaction_handler ( const
+ apply_transaction_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
398 + signal_connection_ptr
+ add_post_apply_transaction_handler ( const
+ apply_transaction_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
399 + signal_connection_ptr add_pre_apply_block_handler
+ ( const apply_block_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
400 + signal_connection_ptr add_post_apply_block_handler
+ ( const apply_block_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
401 + signal_connection_ptr add_fail_apply_block_handler
+ ( const apply_block_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
402 + signal_connection_ptr add_irreversible_block_handler
+ ( const irreversible_block_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
403 + signal_connection_ptr add_switch_fork_handler
+ ( const switch_fork_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
404 + signal_connection_ptr add_pre_reindex_handler
+ ( const reindex_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
405 + signal_connection_ptr add_post_reindex_handler
+ ( const reindex_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
406 + signal_connection_ptr
+ add_pre_apply_custom_operation_handler ( const
+ apply_custom_operation_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
407 + signal_connection_ptr
+ add_post_apply_custom_operation_handler( const
+ apply_custom_operation_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1 );
408 + signal_connection_ptr add_finish_push_block_handler
+ ( const push_block_handler_t& func,
+ const abstract_plugin& plugin, int32_t group = -1 );
409 +
410 + signal_connection_ptr add_prepare_snapshot_handler
+ (const prepare_snapshot_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1);
411 /// <summary>
412 /// All plugins storing data in different way than
chainbase::generic_index (wrapping
413 /// a multi_index) should register to this handler
to add its own data to the prepared snapshot.
...
414 /// <param name="plugin">the plugin be registering
its handler</param>
415 /// <param name="group"></param>
416 /// <returns></returns>
417 - boost::signals2::connection
- add_snapshot_supplement_handler (const
- prepare_snapshot_data_supplement_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1);
417 + signal_connection_ptr
+ add_snapshot_supplement_handler (const
+ prepare_snapshot_data_supplement_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1);
418 /// <summary>
419 /// All plugins storing data in different way than
chainbase::generic_index (wrapping
420 /// a multi_index) should register to this handler
to load its own data from the loaded snapshot.
...
423 /// <param name="plugin"></param>
424 /// <param name="group"></param>
425 /// <returns></returns>
426 - boost::signals2::connection
- add_snapshot_supplement_handler (const
- load_snapshot_data_supplement_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1);
426 + signal_connection_ptr
+ add_snapshot_supplement_handler (const
+ load_snapshot_data_supplement_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1);
427
428 - boost::signals2::connection
- add_comment_reward_handler (const
- comment_reward_notification_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1);
428 + signal_connection_ptr
+ add_comment_reward_handler (const
+ comment_reward_notification_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1);
429
430 - boost::signals2::connection
- add_end_of_syncing_handler (const
- end_of_syncing_notification_handler_t& func, const
- abstract_plugin& plugin, int32_t group = -1);
430 + signal_connection_ptr
+ add_end_of_syncing_handler (const
+ end_of_syncing_notification_handler_t& func, const
+ abstract_plugin& plugin, int32_t group = -1);
431
432 - boost::signals2::connection
- add_wipe_handler (const
- wipe_notification_handler_t& func, const abstract_plugin&
- plugin, int32_t group = -1);
433 - boost::signals2::connection
- add_flush_handler ( const
- flush_handler_t& func, const abstract_plugin& plugin,
- int32_t group = -1 );
432 + signal_connection_ptr
+ add_wipe_handler (const
+ wipe_notification_handler_t& func, const abstract_plugin&
+ plugin, int32_t group = -1);
433 + signal_connection_ptr
+ add_flush_handler ( const
+ flush_handler_t& func, const abstract_plugin& plugin,
+ int32_t group = -1 );
434
435 /// Register a callback for plugin index
initialization (called during initialize_indexes)
436 - boost::signals2::connection
- add_plugin_index_handler( const std::function<void()>&
- func );
436 + signal_connection_ptr
+ add_plugin_index_handler( const std::function<void()>&
+ func );
437
438 //////////////////// db_witness_schedule.cpp
////////////////////
439
● Now I need to update database_init.cpp to return signal_connection_ptr:
● Read(libraries/chain/database_init.cpp)
⎿ Read 100 lines
● Let me search for the add_*_handler implementations in database_init.cpp:
● Search(pattern: "boost::signals2::connection database::", path:
"libraries/chain/database_init.cpp", output_mode: "content")
⎿ Found 22 lines (ctrl+o to expand)
● Read(libraries/chain/database_init.cpp)
⎿ Read 170 lines
● I see the pattern. The functions return boost::signals2::connection
directly from signal.connect(). To return signal_connection_ptr (which is
std::unique_ptr<boost::signals2::connection>), I need to wrap the return
value.
Let me also check the connect_signal_impl function:
● Read(libraries/chain/database_init.cpp)
⎿ Read 30 lines
● I need to update the connect_signal_impl template function and all the
add_*_handler functions to return signal_connection_ptr. The key is to
wrap the boost::signals2::connection in a std::make_unique.
Let me update the helper function first:
● Update(libraries/chain/database_init.cpp)
⎿ Updated libraries/chain/database_init.cpp with 2 additions and 2
removals
416
417 // Local helper function for connecting signal handlers
with benchmarking support
418 template <bool IS_PRE_OPERATION, typename TSignal, typename
TNotification>
419 - boost::signals2::connection
- connect_signal_impl( TSignal& signal, const TNotification&
- func,
419 + database::signal_connection_ptr
+ connect_signal_impl( TSignal& signal, const TNotification&
+ func,
420 util::advanced_benchmark_dumper& benchmark_dumper,
421 const abstract_plugin& plugin, int32_t group, const
std::string& item_name )
422 {
423 fcall<TNotification> fcall_wrapper( func,
benchmark_dumper, plugin,
424 util::advanced_benchmark_dumper::generate_context_desc<
IS_PRE_OPERATION>( plugin.get_name() ), item_name );
425
426 - return signal.connect(group, fcall_wrapper);
426 + return std::make_unique<boost::signals2::connection>(
+ signal.connect(group, fcall_wrapper) );
427 }
428
429 boost::signals2::connection
database::add_pre_apply_operation_handler( const
apply_operation_handler_t& func,
● Now I need to update all the add_*_handler function signatures and their
return statements. Let me do them one by one:
● Update(libraries/chain/database_init.cpp)
⎿ Updated libraries/chain/database_init.cpp with 2 additions and 2
removals
426 return std::make_unique<boost::signals2::connection>(
signal.connect(group, fcall_wrapper) );
427 }
428
429 - boost::signals2::connection
- database::add_pre_apply_operation_handler( const
- apply_operation_handler_t& func,
429 + database::signal_connection_ptr
+ database::add_pre_apply_operation_handler( const
+ apply_operation_handler_t& func,
430 const abstract_plugin& plugin, int32_t group )
431 {
432 std::string context =
util::advanced_benchmark_dumper::generate_context_desc< true
>( plugin.get_name() );
...
446 _benchmark_dumper.end( context, name );
447 };
448
449 - return _my->_pre_apply_operation_signal.connect(group,
- complex_func);
449 + return std::make_unique<boost::signals2::connection>(
+ _my->_pre_apply_operation_signal.connect(group,
+ complex_func) );
450 }
451
452 boost::signals2::connection
database::add_post_apply_operation_handler( const
apply_operation_handler_t& func,
● Update(libraries/chain/database_init.cpp)
⎿ Updated libraries/chain/database_init.cpp with 2 additions and 2
removals
449 return std::make_unique<boost::signals2::connection>(
_my->_pre_apply_operation_signal.connect(group,
complex_func) );
450 }
451
452 - boost::signals2::connection
- database::add_post_apply_operation_handler( const
- apply_operation_handler_t& func,
452 + database::signal_connection_ptr
+ database::add_post_apply_operation_handler( const
+ apply_operation_handler_t& func,
453 const abstract_plugin& plugin, int32_t group )
454 {
455 std::string context =
util::advanced_benchmark_dumper::generate_context_desc<
false >( plugin.get_name() );
...
469 _benchmark_dumper.end( context, name );
470 };
471
472 - return _my->_post_apply_operation_signal.connect(group,
- complex_func);
472 + return std::make_unique<boost::signals2::connection>(
+ _my->_post_apply_operation_signal.connect(group,
+ complex_func) );
473 }
474
475 boost::signals2::connection
database::add_pre_apply_transaction_handler( const
apply_transaction_handler_t& func,
● Update(libraries/chain/database_init.cpp)
⎿ Updated libraries/chain/database_init.cpp with 21 additions and 21
removals
472 return std::make_unique<boost::signals2::connection>(
_my->_post_apply_operation_signal.connect(group,
complex_func) );
473 }
474
475 - boost::signals2::connection
- database::add_pre_apply_transaction_handler( const
- apply_transaction_handler_t& func,
475 + database::signal_connection_ptr
+ database::add_pre_apply_transaction_handler( const
+ apply_transaction_handler_t& func,
476 const abstract_plugin& plugin, int32_t group )
477 {
478 return connect_signal_impl<true>(_my->_pre_apply_transact
ion_signal, func, _benchmark_dumper, plugin, group,
"transaction");
479 }
480
481 - boost::signals2::connection
- database::add_post_apply_transaction_handler( const
- apply_transaction_handler_t& func,
481 + database::signal_connection_ptr
+ database::add_post_apply_transaction_handler( const
+ apply_transaction_handler_t& func,
482 const abstract_plugin& plugin, int32_t group )
483 {
484 return connect_signal_impl<false>(_my->_post_apply_transa
ction_signal, func, _benchmark_dumper, plugin, group,
"transaction");
485 }
486
487 - boost::signals2::connection
- database::add_pre_apply_custom_operation_handler ( const
- apply_custom_operation_handler_t& func,
487 + database::signal_connection_ptr
+ database::add_pre_apply_custom_operation_handler ( const
+ apply_custom_operation_handler_t& func,
488 const abstract_plugin& plugin, int32_t group )
489 {
490 return connect_signal_impl< true
>(_my->_pre_apply_custom_operation_signal, func,
_benchmark_dumper, plugin, group, "custom");
491 }
492
493 - boost::signals2::connection
- database::add_post_apply_custom_operation_handler( const
- apply_custom_operation_handler_t& func,
493 + database::signal_connection_ptr
+ database::add_post_apply_custom_operation_handler( const
+ apply_custom_operation_handler_t& func,
494 const abstract_plugin& plugin, int32_t group )
495 {
496 return connect_signal_impl< false
>(_my->_post_apply_custom_operation_signal, func,
_benchmark_dumper, plugin, group, "custom");
497 }
498
499 - boost::signals2::connection
- database::add_pre_apply_block_handler( const
- apply_block_handler_t& func,
499 + database::signal_connection_ptr
+ database::add_pre_apply_block_handler( const
+ apply_block_handler_t& func,
500 const abstract_plugin& plugin, int32_t group )
501 {
502 return
connect_signal_impl<true>(_my->_pre_apply_block_signal,
func, _benchmark_dumper, plugin, group, "block");
503 }
504
505 - boost::signals2::connection
- database::add_post_apply_block_handler( const
- apply_block_handler_t& func,
505 + database::signal_connection_ptr
+ database::add_post_apply_block_handler( const
+ apply_block_handler_t& func,
506 const abstract_plugin& plugin, int32_t group )
507 {
508 return
connect_signal_impl<false>(_my->_post_apply_block_signal,
func, _benchmark_dumper, plugin, group, "block");
509 }
510
511 - boost::signals2::connection
- database::add_fail_apply_block_handler( const
- apply_block_handler_t& func,
511 + database::signal_connection_ptr
+ database::add_fail_apply_block_handler( const
+ apply_block_handler_t& func,
512 const abstract_plugin& plugin, int32_t group )
513 {
514 return
connect_signal_impl<false>(_my->_fail_apply_block_signal,
func, _benchmark_dumper, plugin, group, "failed block");
515 }
516
517 - boost::signals2::connection
- database::add_irreversible_block_handler( const
- irreversible_block_handler_t& func,
517 + database::signal_connection_ptr
+ database::add_irreversible_block_handler( const
+ irreversible_block_handler_t& func,
518 const abstract_plugin& plugin, int32_t group )
519 {
520 return
connect_signal_impl<false>(_my->_on_irreversible_block,
func, _benchmark_dumper, plugin, group, "irreversible");
521 }
522
523 - boost::signals2::connection
- database::add_switch_fork_handler( const
- switch_fork_handler_t& func,
523 + database::signal_connection_ptr
+ database::add_switch_fork_handler( const
+ switch_fork_handler_t& func,
524
const abstract_plugin& plugin, int32_t group )
525 {
526 return
connect_signal_impl<false>(_my->_switch_fork_signal, func,
_benchmark_dumper, plugin, group, "switch_fork");
527 }
528
529 - boost::signals2::connection
- database::add_pre_reindex_handler(const reindex_handler_t&
- func,
529 + database::signal_connection_ptr
+ database::add_pre_reindex_handler(const reindex_handler_t&
+ func,
530 const abstract_plugin& plugin, int32_t group )
531 {
532 return
connect_signal_impl<true>(_my->_pre_reindex_signal, func,
_benchmark_dumper, plugin, group, "reindex");
533 }
534
535 - boost::signals2::connection
- database::add_post_reindex_handler(const
- reindex_handler_t& func,
535 + database::signal_connection_ptr
+ database::add_post_reindex_handler(const
+ reindex_handler_t& func,
536 const abstract_plugin& plugin, int32_t group )
537 {
538 return
connect_signal_impl<false>(_my->_post_reindex_signal, func,
_benchmark_dumper, plugin, group, "reindex");
539 }
540
541 - boost::signals2::connection
- database::add_finish_push_block_handler( const
- push_block_handler_t& func,
541 + database::signal_connection_ptr
+ database::add_finish_push_block_handler( const
+ push_block_handler_t& func,
542 const abstract_plugin& plugin, int32_t group )
543 {
544 return
connect_signal_impl<false>(_my->_finish_push_block_signal,
func, _benchmark_dumper, plugin, group, "block");
545 }
546
547 - boost::signals2::connection
- database::add_prepare_snapshot_handler(const
- prepare_snapshot_handler_t& func, const abstract_plugin&
- plugin, int32_t group)
547 + database::signal_connection_ptr
+ database::add_prepare_snapshot_handler(const
+ prepare_snapshot_handler_t& func, const abstract_plugin&
+ plugin, int32_t group)
548 {
549 return
connect_signal_impl<true>(_my->_prepare_snapshot_signal,
func, _benchmark_dumper, plugin, group, "prepare_snapshot");
550 }
551
552 - boost::signals2::connection
- database::add_snapshot_supplement_handler(const
- prepare_snapshot_data_supplement_handler_t& func, const
- abstract_plugin& plugin, int32_t group)
552 + database::signal_connection_ptr
+ database::add_snapshot_supplement_handler(const
+ prepare_snapshot_data_supplement_handler_t& func, const
+ abstract_plugin& plugin, int32_t group)
553 {
554 return connect_signal_impl<true>(_my->_prepare_snapshot_s
upplement_signal, func, _benchmark_dumper, plugin, group,
"prepare_snapshot_data_supplement");
555 }
556
557 - boost::signals2::connection
- database::add_snapshot_supplement_handler(const
- load_snapshot_data_supplement_handler_t& func, const
- abstract_plugin& plugin, int32_t group)
557 + database::signal_connection_ptr
+ database::add_snapshot_supplement_handler(const
+ load_snapshot_data_supplement_handler_t& func, const
+ abstract_plugin& plugin, int32_t group)
558 {
559 return connect_signal_impl<true>(_my->_load_snapshot_supp
lement_signal, func, _benchmark_dumper, plugin, group,
"load_snapshot_data_supplement");
560 }
561
562 - boost::signals2::connection
- database::add_comment_reward_handler(const
- comment_reward_notification_handler_t& func, const
- abstract_plugin& plugin, int32_t group)
562 + database::signal_connection_ptr
+ database::add_comment_reward_handler(const
+ comment_reward_notification_handler_t& func, const
+ abstract_plugin& plugin, int32_t group)
563 {
564 return
connect_signal_impl<true>(_my->_comment_reward_signal, func,
_benchmark_dumper, plugin, group, "comment_reward");
565 }
566
567 - boost::signals2::connection
- database::add_end_of_syncing_handler(const
- end_of_syncing_notification_handler_t& func, const
- abstract_plugin& plugin, int32_t group)
567 + database::signal_connection_ptr
+ database::add_end_of_syncing_handler(const
+ end_of_syncing_notification_handler_t& func, const
+ abstract_plugin& plugin, int32_t group)
568 {
569 return
connect_signal_impl<false>(_my->_end_of_syncing_signal,
func, _benchmark_dumper, plugin, group, "->syncing_end");
570 }
571
572 - boost::signals2::connection
- database::add_wipe_handler(const
- wipe_notification_handler_t& func, const abstract_plugin&
- plugin, int32_t group)
572 + database::signal_connection_ptr
+ database::add_wipe_handler(const
+ wipe_notification_handler_t& func, const abstract_plugin&
+ plugin, int32_t group)
573 {
574 return connect_signal_impl<false>(_my->_wipe_signal,
func, _benchmark_dumper, plugin, group, "wipe storages");
575 }
576
577 - boost::signals2::connection
- database::add_flush_handler( const flush_handler_t& func,
577 + database::signal_connection_ptr
+ database::add_flush_handler( const flush_handler_t& func,
578 const abstract_plugin& plugin, int32_t group )
579 {
580 return connect_signal_impl<false>(_my->_flush_signal,
func, _benchmark_dumper, plugin, group, "flush");
581 }
582
583 - boost::signals2::connection
- database::add_plugin_index_handler( const
- std::function<void()>& func )
583 + database::signal_connection_ptr
+ database::add_plugin_index_handler( const
+ std::function<void()>& func )
584 {
585 - return _my->_plugin_index_signal.connect( func );
585 + return std::make_unique<boost::signals2::connection>(
+ _my->_plugin_index_signal.connect( func ) );
586 }
587
588 } } // hive::chain
● Now let me update the todos and find the callers that need to be updated:
● Let me try a build first to see what callers need to be updated:
● Bash(ninja -j8 hived 2>&1 | head -300) timeout: 5m 0s
⎿ ninja: error: loading 'build.ninja': No such file or directory
● Bash(cd /storage1/src/hive/build && ninja -j8 hived 2>&1 | head timeout: 5m
-300) 0s
⎿ [0/1] Re-running CMake...
-- CMAKE_C_FLAGS_ASAN value is based on: CMAKE_C_FLAGS_RELWITHDEBINFO a
nd points to value: -O2 -g -DNDEBUG
… +441 lines (ctrl+o to expand)
● Let me wait for the build to continue:
● Bash(ninja -j8 hived 2>&1 | tail -300) timeout: 5m 0s
⎿ -- Adding condenser_api/get_version to test list
-- Adding condenser_api/get_vesting_delegations to test list
-- Adding condenser_api/get_volume to test list
… +575 lines (ctrl+o to expand)
● I see the problem. The callers are storing boost::signals2::connection
objects directly and need to be updated to use signal_connection_ptr. Let
me search for all the files that store connections:
● Search(pattern: "boost::signals2::connection\s+_", path: "libraries/plugins")
⎿ Found 14 files (ctrl+o to expand)
● Search(pattern: "boost::signals2::connection\s+_", path: "libraries/plugins",
output_mode: "content")
⎿ Found 28 lines (ctrl+o to expand)
● I need to replace boost::signals2::connection with signal_connection_ptr
in all of these files. Let me also check if there are others that use
db.add_*_handler:
● Search(pattern: "\.add_\w+_handler\(", path: "libraries/plugins")
⎿ Found 18 files (ctrl+o to expand)
● This is a lot of files. The most straightforward approach is to replace
boost::signals2::connection with
hive::chain::database::signal_connection_ptr in all the plugin files. Let
me do this in batches.
● Update(libraries/plugins/block_log_info/block_log_info_plugin.cpp)
⎿ File must be read first
● Read(libraries/plugins/block_log_info/block_log_info_plugin.cpp)
⎿ Read 30 lines
● Update(libraries/plugins/block_log_info/block_log_info_plugin.cpp)
⎿ Updated libraries/plugins/block_log_info/block_log_info_plugin.cpp wit
1 addition and 1 removal
33
34 database& _db;
35 block_log_info_plugin& _self;
36 - boost::signals2::connection _post_apply_block_conn;
36 + chain::database::signal_connection_ptr
+ _post_apply_block_conn;
37 int32_t print_interval_seconds =
0;
38 bool print_irreversible = true;
39 std::string output_name;
● I need to also update the usage of the connection. Since
signal_connection_ptr is a unique_ptr, I need to dereference it when
disconnecting. Let me check how these connections are used:
● Search(pattern: "_post_apply_block_conn", path:
"libraries/plugins/block_log_info/block_log_info_plugin.cpp",
output_mode: "content")
⎿ Found 3 lines (ctrl+o to expand)
● The disconnect_signal function already has an overload for
signal_connection_ptr that I added earlier. Let me continue updating the
other files. Let me read and update each file one by one:
● Read(libraries/plugins/comment_cashout_logging/comment_cashout_logging_plugin.
cpp)
⎿ Read 15 lines
● Update(libraries/plugins/comment_cashout_logging/comment_cashout_logging_plugi
n.cpp)
⎿ Updated libraries/plugins/comment_cashout_logging/comment_cashout_logg
ng_plugin.cpp with 1 addition and 1 removal
41 std::string make_file_name(bool &changed);
42
43 database& _db;
44 - boost::signals2::connection
- _pre_apply_operation_conn;
44 + chain::database::signal_connection_ptr
+ _pre_apply_operation_conn;
45
46 optional<uint64_t> _starting_block;
47 optional<uint64_t> _ending_block;
● Read(libraries/plugins/queen/queen_plugin.cpp)
⎿ Read 15 lines
● Update(libraries/plugins/queen/queen_plugin.cpp)
⎿ Updated libraries/plugins/queen/queen_plugin.cpp with 3 additions and
removals
63 fc::microseconds max_full_block_cycle_time;
64 fc::microseconds total_full_block_cycle_time;
65
66 - boost::signals2::connection
- _post_apply_transaction_conn;
67 - boost::signals2::connection _finish_push_block_conn;
68 - boost::signals2::connection _fail_apply_block_conn;
66 + chain::database::signal_connection_ptr
+ _post_apply_transaction_conn;
67 + chain::database::signal_connection_ptr
+ _finish_push_block_conn;
68 + chain::database::signal_connection_ptr
+ _fail_apply_block_conn;
69 };
70
71 class queen_generate_block_flow_control final : public
generate_block_flow_control
● Read(libraries/plugins/reputation/reputation_plugin.cpp)
⎿ Read 15 lines
● Update(libraries/plugins/reputation/reputation_plugin.cpp)
⎿ Updated libraries/plugins/reputation/reputation_plugin.cpp with 2
additions and 2 removals
41
42 chain::database& _db;
43 reputation_plugin& _self;
44 - boost::signals2::connection _pre_apply_operation_conn;
45 - boost::signals2::connection
- _post_apply_operation_conn;
44 + chain::database::signal_connection_ptr
+ _pre_apply_operation_conn;
45 + chain::database::signal_connection_ptr
+ _post_apply_operation_conn;
46 };
47
48 struct pre_operation_visitor
● Read(libraries/plugins/market_history/market_history_plugin.cpp)
⎿ Read 10 lines
● Update(libraries/plugins/market_history/market_history_plugin.cpp)
⎿ Updated libraries/plugins/market_history/market_history_plugin.cpp wit
1 addition and 1 removal
38 flat_set<uint32_t> _tracked_buckets =
flat_set<uint32_t> { 15, 60, 300, 3600, 86400 };
39 int32_t
_maximum_history_per_bucket_size = 86400 / 15; // smallest
buckets should
40 // cover at least 24 hours, otherwise
get_ticker/get_volume api calls won't work properly
41 - boost::signals2::connection
- _post_apply_operation_conn;
41 + chain::database::signal_connection_ptr
+ _post_apply_operation_conn;
42 };
43
44 void market_history_plugin_impl::on_post_apply_operation(
const operation_notification& o )
● Read(libraries/plugins/witness/witness_plugin.cpp)
⎿ Read 15 lines
● Update(libraries/plugins/witness/witness_plugin.cpp)
⎿ Updated libraries/plugins/witness/witness_plugin.cpp with 2 additions
and 2 removals
90 plugins::chain::chain_plugin& _chain_plugin;
91 chain::database& _db;