Kea 3.3.3
d2_process.h
Go to the documentation of this file.
1// Copyright (C) 2013-2026 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#ifndef D2_PROCESS_H
8#define D2_PROCESS_H
9
10#include <d2/d2_queue_mgr.h>
11#include <d2/d2_update_mgr.h>
12#include <process/d_process.h>
13
14#include <cstdint>
15
16namespace isc {
17namespace d2 {
18
27public:
28
43
50 static const unsigned int QUEUE_RESTART_PERCENT;
51
54 static const unsigned int IO_SERVICE_RUN_TIME_USECS;
55
67 D2Process(const char* name, const asiolink::IOServicePtr& io_service);
68
78 virtual void init();
79
111 virtual void run();
112
139
164 bool check_only = false);
165
167 virtual ~D2Process();
168
169protected:
198 virtual void checkQueueStatus();
199
208 virtual void reconfigureQueueMgr();
209
230 virtual size_t runIO();
231
239 virtual bool canShutdown() const;
240
246 void setReconfQueueFlag(const bool value) {
247 reconf_queue_flag_ = value;
248 }
249
255 void setShutdownType(const ShutdownType& value) {
256 shutdown_type_ = value;
257 }
258
267
268public:
273
276 return (queue_mgr_);
277 }
278
281 return (update_mgr_);
282 }
283
285 bool getReconfQueueFlag() const {
286 return (reconf_queue_flag_);
287 }
288
293 return (shutdown_type_);
294 }
295
302 static const char* getShutdownTypeStr(const ShutdownType& type);
303
304private:
306 D2QueueMgrPtr queue_mgr_;
307
309 D2UpdateMgrPtr update_mgr_;
310
312 bool reconf_queue_flag_;
313
315 ShutdownType shutdown_type_;
316
318 isc::data::ConstElementPtr current_unix_control_socket_;
319
321 isc::data::ConstElementPtr current_http_control_socket_;
322};
323
325typedef boost::shared_ptr<D2Process> D2ProcessPtr;
326
327} // namespace isc::d2
328} // namespace isc
329
330#endif
D2Process(const char *name, const asiolink::IOServicePtr &io_service)
Constructor.
Definition d2_process.cc:62
static const unsigned int IO_SERVICE_RUN_TIME_USECS
Amount of time to allow the main IOSerivce to wait for ready handlers before timimg out in microsecon...
Definition d2_process.h:54
static const unsigned int QUEUE_RESTART_PERCENT
Defines the point at which to resume receiving requests.
Definition d2_process.h:50
void setShutdownType(const ShutdownType &value)
Sets the shutdown type to the given value.
Definition d2_process.h:255
virtual bool canShutdown() const
Indicates whether or not the process can perform a shutdown.
virtual void checkQueueStatus()
Monitors current queue manager state, takes action accordingly.
virtual ~D2Process()
Destructor.
const D2QueueMgrPtr & getD2QueueMgr() const
Returns a reference to the queue manager.
Definition d2_process.h:275
bool getReconfQueueFlag() const
Returns true if the queue manager should be reconfigured.
Definition d2_process.h:285
virtual void run()
Implements the process's event loop.
const D2UpdateMgrPtr & getD2UpdateMgr() const
Returns a reference to the update manager.
Definition d2_process.h:280
virtual void init()
Called after instantiation to perform initialization unique to D2.
Definition d2_process.cc:84
D2CfgMgrPtr getD2CfgMgr()
Returns a pointer to the configuration manager.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)
Processes the given configuration.
void setReconfQueueFlag(const bool value)
Sets queue reconfigure indicator to the given value.
Definition d2_process.h:246
ShutdownType getShutdownType() const
Returns the type of shutdown requested.
Definition d2_process.h:292
void reconfigureCommandChannel()
(Re-)Configure the command channel.
virtual void reconfigureQueueMgr()
Initializes then starts the queue manager.
ShutdownType
Defines the shutdown types supported by D2Process.
Definition d2_process.h:38
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)
Initiates the D2Process shutdown process.
static const char * getShutdownTypeStr(const ShutdownType &type)
Returns a text label for the given shutdown type.
virtual size_t runIO()
Allows IO processing to run until at least callback is invoked.
Application Process Interface.
Definition d_process.h:75
This file defines the class D2QueueMgr.
This file defines the class D2UpdateMgr.
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition d2_cfg_mgr.h:389
boost::shared_ptr< D2Process > D2ProcessPtr
Defines a shared pointer to D2Process.
Definition d2_process.h:325
boost::shared_ptr< D2UpdateMgr > D2UpdateMgrPtr
Defines a pointer to a D2UpdateMgr instance.
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
Defines the logger used by the top-level component of kea-lfc.