Priority scheduler config

This commit is contained in:
Piotr Wójcik 2024-05-12 12:53:17 +02:00
commit a29f929162
3 changed files with 18 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include <nano/node/request_aggregator.hpp>
#include <nano/node/scheduler/hinted.hpp>
#include <nano/node/scheduler/optimistic.hpp>
#include <nano/node/scheduler/priority.hpp>
#include <nano/node/transport/tcp_listener.hpp>
#include <nano/node/vote_cache.hpp>
#include <nano/node/vote_processor.hpp>
@ -66,6 +67,7 @@ public:
std::optional<uint16_t> peering_port{};
nano::scheduler::optimistic_config optimistic_scheduler;
nano::scheduler::hinted_config hinted_scheduler;
nano::scheduler::priority_config priority_scheduler;
std::vector<std::pair<std::string, uint16_t>> work_peers;
std::vector<std::pair<std::string, uint16_t>> secondary_work_peers{ { "127.0.0.1", 8076 } }; /* Default of nano-pow-server */
std::vector<std::string> preconfigured_peers;

View file

@ -9,6 +9,7 @@
#include <nano/secure/ledger_set_confirmed.hpp>
nano::scheduler::priority::priority (nano::node & node_a, nano::stats & stats_a) :
config{ node_a.config.priority_scheduler },
node{ node_a },
stats{ stats_a },
buckets{ std::make_unique<scheduler::buckets> () }
@ -25,6 +26,11 @@ void nano::scheduler::priority::start ()
{
debug_assert (!thread.joinable ());
if (!config.enabled)
{
return;
}
thread = std::thread{ [this] () {
nano::thread_role::set (nano::thread_role::name::scheduler_priority);
run ();

View file

@ -24,6 +24,15 @@ class transaction;
namespace nano::scheduler
{
class priority_config
{
public:
// TODO: Serialization & deserialization
public:
bool enabled{ true };
};
class buckets;
class priority final
{
@ -46,6 +55,7 @@ public:
std::unique_ptr<container_info_component> collect_container_info (std::string const & name);
private: // Dependencies
priority_config const & config;
nano::node & node;
nano::stats & stats;