Skip to content

Commit 8596d91

Browse files
eddyashtonachamayouCopilot
authored
Replace threadmessaging with new task system (#7422)
Co-authored-by: Amaury Chamayou <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 959a3e1 commit 8596d91

35 files changed

+499
-1300
lines changed

CMakeLists.txt

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ add_ccf_static_library(
376376
ccf_endpoints
377377
ccfcrypto
378378
ccf_kv
379+
ccf_tasks
379380
nghttp2
380381
${CMAKE_THREAD_LIBS_INIT}
381382
curl
@@ -556,7 +557,6 @@ if(BUILD_TESTS)
556557
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/serialized.cpp
557558
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/serializer.cpp
558559
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/hash.cpp
559-
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/thread_messaging.cpp
560560
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/lru.cpp
561561
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/hex.cpp
562562
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/contiguous_set.cpp
@@ -591,7 +591,7 @@ if(BUILD_TESTS)
591591
${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/aft/test/view_history.cpp
592592
${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/aft/test/committable_suffix.cpp
593593
)
594-
target_link_libraries(raft_test PRIVATE ccfcrypto)
594+
target_link_libraries(raft_test PRIVATE ccfcrypto ccf_tasks)
595595

596596
add_unit_test(
597597
raft_enclave_test
@@ -622,7 +622,9 @@ if(BUILD_TESTS)
622622
add_unit_test(
623623
history_test ${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/history.cpp
624624
)
625-
target_link_libraries(history_test PRIVATE ccfcrypto http_parser ccf_kv)
625+
target_link_libraries(
626+
history_test PRIVATE ccfcrypto http_parser ccf_kv ccf_tasks
627+
)
626628

627629
add_unit_test(
628630
encryptor_test ${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/encryptor.cpp
@@ -655,23 +657,26 @@ if(BUILD_TESTS)
655657
)
656658
target_link_libraries(
657659
historical_queries_test PRIVATE http_parser ccf_kv ccf_endpoints
660+
ccf_tasks
658661
)
659662
add_unit_test(
660663
indexing_test ${CMAKE_CURRENT_SOURCE_DIR}/src/indexing/test/indexing.cpp
661664
${CMAKE_CURRENT_SOURCE_DIR}/src/indexing/test/lfs.cpp
662665
)
663-
target_link_libraries(indexing_test PRIVATE ccf_endpoints ccf_kv)
666+
target_link_libraries(indexing_test PRIVATE ccf_endpoints ccf_kv ccf_tasks)
664667

665668
add_unit_test(
666669
snapshot_test ${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/snapshot.cpp
667670
)
668-
target_link_libraries(snapshot_test PRIVATE ccf_kv)
671+
target_link_libraries(snapshot_test PRIVATE ccf_kv ccf_tasks)
669672

670673
add_unit_test(
671674
snapshotter_test
672675
${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/snapshotter.cpp
673676
)
674-
target_link_libraries(snapshotter_test PRIVATE ccf_kv ccf_endpoints)
677+
target_link_libraries(
678+
snapshotter_test PRIVATE ccf_kv ccf_endpoints ccf_tasks
679+
)
675680

676681
add_unit_test(
677682
node_info_json_test
@@ -722,8 +727,14 @@ if(BUILD_TESTS)
722727
${CCF_DIR}/src/node/quote.cpp ${CCF_DIR}/src/node/uvm_endorsements.cpp
723728
)
724729
target_link_libraries(
725-
frontend_test PRIVATE ${CMAKE_THREAD_LIBS_INIT} http_parser ccf_js
726-
ccf_endpoints ccfcrypto ccf_kv
730+
frontend_test
731+
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
732+
http_parser
733+
ccf_js
734+
ccf_endpoints
735+
ccfcrypto
736+
ccf_kv
737+
ccf_tasks
727738
)
728739

729740
add_unit_test(
@@ -775,7 +786,7 @@ if(BUILD_TESTS)
775786
raft_driver ${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/aft/test/driver.cpp
776787
src/enclave/thread_local.cpp
777788
)
778-
target_link_libraries(raft_driver PRIVATE ccfcrypto)
789+
target_link_libraries(raft_driver PRIVATE ccfcrypto ccf_tasks)
779790
target_include_directories(raft_driver PRIVATE src/aft)
780791

781792
add_test(
@@ -818,7 +829,7 @@ if(BUILD_TESTS)
818829
add_picobench(
819830
history_bench
820831
SRCS src/node/test/history_bench.cpp src/enclave/thread_local.cpp
821-
LINK_LIBS ccf_kv
832+
LINK_LIBS ccf_kv ccf_tasks
822833
)
823834

824835
add_picobench(

cmake/common.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ function(add_picobench name)
225225
bash -c
226226
"$<TARGET_FILE:${name}> --samples=10 --out-fmt=csv --output=${name}.csv && cat ${name}.csv"
227227
)
228-
229-
set_property(TEST ${name} PROPERTY LABELS benchmark)
228+
set_property(
229+
TEST ${name}
230+
APPEND
231+
PROPERTY LABELS benchmark
232+
)
230233

231234
add_san_test_properties(${name})
232235
endfunction()

src/consensus/aft/raft.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "ccf/tx_id.h"
99
#include "ccf/tx_status.h"
1010
#include "consensus/aft/raft_types.h"
11+
#include "ds/ccf_assert.h"
1112
#include "ds/internal_logger.h"
1213
#include "ds/serialized.h"
1314
#include "impl/state.h"

src/consensus/aft/test/driver.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ int main(int argc, char** argv)
3838
#endif
3939
ccf::logger::config::level() = ccf::LoggerLevel::DEBUG;
4040

41-
threading::ThreadMessaging::init(1);
42-
4341
const std::string filename = argv[1];
4442

4543
std::ifstream fstream;

src/consensus/aft/test/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,6 @@ DOCTEST_TEST_CASE(
10101010

10111011
int main(int argc, char** argv)
10121012
{
1013-
threading::ThreadMessaging::init(1);
10141013
doctest::Context context;
10151014
context.applyCommandLine(argc, argv);
10161015
int res = context.run();

src/crypto/openssl/symmetric_key.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "ccf/crypto/openssl/openssl_wrappers.h"
77
#include "ccf/crypto/symmetric_key.h"
88
#include "ds/internal_logger.h"
9-
#include "ds/thread_messaging.h"
109

1110
#include <climits>
1211
#include <openssl/aes.h>

src/ds/serializer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ namespace serializer
2727
{
2828
const uint8_t* data;
2929
const size_t size;
30+
31+
operator std::span<const uint8_t>() const
32+
{
33+
return std::span<const uint8_t>(data, size);
34+
}
3035
};
3136

3237
namespace details

src/ds/test/messaging.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "../non_blocking.h"
66
#include "../ring_buffer.h"
77
#include "../serialized.h"
8-
#include "../thread_messaging.h"
98

109
#include <array>
1110
#include <doctest/doctest.h>

src/ds/test/thread_messaging.cpp

Lines changed: 0 additions & 214 deletions
This file was deleted.

0 commit comments

Comments
 (0)