3 #include <condition_variable>
39 std::optional<uint64_t>
push(std::pair<tarcap::TarcapVersion, PacketData>&& packet_data);
62 std::shared_ptr<tarcap::PacketsHandler> packets_handlers);
80 std::unordered_map<tarcap::TarcapVersion, std::shared_ptr<tarcap::PacketsHandler>>
packets_handlers_;
Definition: FixedHash.h:35
PacketsThreadPool for concurrent packets processing.
Definition: tarcap_thread_pool.hpp:21
std::tuple< size_t, size_t, size_t > getQueueSize() const
Returns actual size of all priority queues (thread-safe)
Definition: tarcap_thread_pool.cpp:148
std::atomic< bool > stopProcessing_
Definition: tarcap_thread_pool.hpp:83
~PacketsThreadPool()
Definition: tarcap_thread_pool.cpp:19
PacketsThreadPool & operator=(PacketsThreadPool &&)=delete
std::condition_variable cond_var_
Definition: tarcap_thread_pool.hpp:95
PacketsThreadPool(PacketsThreadPool &&)=delete
void stopProcessing()
Stop all processing threads.
Definition: tarcap_thread_pool.cpp:72
PacketsThreadPool(size_t workers_num=10, const addr_t &node_addr={})
Definition: tarcap_thread_pool.cpp:7
void setPacketsHandlers(tarcap::TarcapVersion tarcap_version, std::shared_ptr< tarcap::PacketsHandler > packets_handlers)
Sets packet handler.
Definition: tarcap_thread_pool.cpp:140
void startProcessing()
Start all processing threads.
Definition: tarcap_thread_pool.cpp:58
LOG_OBJECTS_DEFINE const size_t workers_num_
Definition: tarcap_thread_pool.hpp:77
PacketsThreadPool(const PacketsThreadPool &)=delete
std::optional< uint64_t > push(std::pair< tarcap::TarcapVersion, PacketData > &&packet_data)
Push the given element value to the end of the queue. Used for r-values.
Definition: tarcap_thread_pool.cpp:34
std::unordered_map< tarcap::TarcapVersion, std::shared_ptr< tarcap::PacketsHandler > > packets_handlers_
Definition: tarcap_thread_pool.hpp:80
std::mutex queue_mutex_
Definition: tarcap_thread_pool.hpp:92
uint64_t packets_count_
Definition: tarcap_thread_pool.hpp:86
PriorityQueue queue_
Definition: tarcap_thread_pool.hpp:89
PacketsThreadPool & operator=(const PacketsThreadPool &)=delete
void processPacket(size_t worker_id)
Threadpool sycnchronized processing function, which internally calls packet-specific handlers.
Definition: tarcap_thread_pool.cpp:80
std::vector< std::thread > workers_
Definition: tarcap_thread_pool.hpp:98
Definition: priority_queue.hpp:15
#define LOG_OBJECTS_DEFINE
Definition: logger.hpp:60
Definition: vote_manager.hpp:23
unsigned TarcapVersion
Definition: tarcap_version.hpp:4
Definition: node_stats.hpp:17