Kea 2.2.0
cfg_multi_threading.cc
Go to the documentation of this file.
1// Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
9#include <cc/data.h>
10#include <cc/simple_parser.h>
11#include <cfg_multi_threading.h>
13
14using namespace isc::data;
15using namespace isc::util;
16
17namespace isc {
18namespace dhcp {
19
20void
22 bool enabled = false;
23 uint32_t thread_count = 0;
24 uint32_t queue_size = 0;
25 CfgMultiThreading::extract(value, enabled, thread_count, queue_size);
26 MultiThreadingMgr::instance().apply(enabled, thread_count, queue_size);
27}
28
29void
31 uint32_t& thread_count, uint32_t& queue_size) {
32 enabled = false;
33 thread_count = 0;
34 queue_size = 0;
35 if (value) {
36 if (value->get("enable-multi-threading")) {
37 enabled = SimpleParser::getBoolean(value, "enable-multi-threading");
38 }
39
40 if (value->get("thread-pool-size")) {
41 thread_count = SimpleParser::getInteger(value, "thread-pool-size");
42 }
43
44 if (value->get("packet-queue-size")) {
45 queue_size = SimpleParser::getInteger(value, "packet-queue-size");
46 }
47 }
48}
49
50} // namespace dhcp
51} // namespace isc
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
static void apply(data::ConstElementPtr value)
apply multi threading configuration
static void extract(data::ConstElementPtr value, bool &enabled, uint32_t &thread_count, uint32_t &queue_size)
extract multi threading parameters
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
Definition: edns.h:19
Defines the logger used by the top-level component of kea-lfc.