Kea  1.9.9-git
d2_process.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2019 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 namespace isc {
15 namespace d2 {
16 
25 public:
26 
36  enum ShutdownType {
40  };
41 
48  static const unsigned int QUEUE_RESTART_PERCENT;
49 
61  D2Process(const char* name, const asiolink::IOServicePtr& io_service);
62 
72  virtual void init();
73 
105  virtual void run();
106 
134 
160  bool check_only = false);
161 
163  virtual ~D2Process();
164 
165 protected:
194  virtual void checkQueueStatus();
195 
204  virtual void reconfigureQueueMgr();
205 
226  virtual size_t runIO();
227 
235  virtual bool canShutdown() const;
236 
242  void setReconfQueueFlag(const bool value) {
243  reconf_queue_flag_ = value;
244  }
245 
251  void setShutdownType(const ShutdownType& value) {
252  shutdown_type_ = value;
253  }
254 
263 
264 public:
269 
271  const D2QueueMgrPtr& getD2QueueMgr() const {
272  return (queue_mgr_);
273  }
274 
277  return (update_mgr_);
278  }
279 
281  bool getReconfQueueFlag() const {
282  return (reconf_queue_flag_);
283  }
284 
289  return (shutdown_type_);
290  }
291 
298  static const char* getShutdownTypeStr(const ShutdownType& type);
299 
300 private:
302  D2QueueMgrPtr queue_mgr_;
303 
305  D2UpdateMgrPtr update_mgr_;
306 
308  bool reconf_queue_flag_;
309 
311  ShutdownType shutdown_type_;
312 
314  isc::data::ConstElementPtr current_control_socket_;
315 
316 };
317 
319 typedef boost::shared_ptr<D2Process> D2ProcessPtr;
320 
321 }; // namespace isc::d2
322 }; // namespace isc
323 
324 #endif
bool getReconfQueueFlag() const
Returns true if the queue manager should be reconfigured.
Definition: d2_process.h:281
void setReconfQueueFlag(const bool value)
Sets queue reconfigure indicator to the given value.
Definition: d2_process.h:242
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)
Initiates the D2Process shutdown process.
Definition: d2_process.cc:197
virtual void init()
Called after instantiation to perform initialization unique to D2.
Definition: d2_process.cc:68
static const char * getShutdownTypeStr(const ShutdownType &type)
Returns a text label for the given shutdown type.
Definition: d2_process.cc:434
D2CfgMgrPtr getD2CfgMgr()
Returns a pointer to the configuration manager.
Definition: d2_process.cc:427
void reconfigureCommandChannel()
(Re-)Configure the command channel.
Definition: d2_process.cc:454
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
Definition: d2_queue_mgr.h:343
virtual void checkQueueStatus()
Monitors current queue manager state, takes action accordingly.
Definition: d2_process.cc:296
virtual ~D2Process()
Destructor.
Definition: d2_process.cc:423
D2Process(const char *name, const asiolink::IOServicePtr &io_service)
Constructor.
Definition: d2_process.cc:49
const D2UpdateMgrPtr & getD2UpdateMgr() const
Returns a reference to the update manager.
Definition: d2_process.h:276
virtual bool canShutdown() const
Indicates whether or not the process can perform a shutdown.
Definition: d2_process.cc:152
DHCP-DDNS Application Process.
Definition: d2_process.h:24
virtual void run()
Implements the process's event loop.
Definition: d2_process.cc:74
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:334
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< D2Process > D2ProcessPtr
Defines a shared pointer to D2Process.
Definition: d2_process.h:319
boost::shared_ptr< D2UpdateMgr > D2UpdateMgrPtr
Defines a pointer to a D2UpdateMgr instance.
ShutdownType
Defines the shutdown types supported by D2Process.
Definition: d2_process.h:36
Defines the logger used by the top-level component of kea-dhcp-ddns.
const D2QueueMgrPtr & getD2QueueMgr() const
Returns a reference to the queue manager.
Definition: d2_process.h:271
ShutdownType getShutdownType() const
Returns the type of shutdown requested.
Definition: d2_process.h:288
virtual void reconfigureQueueMgr()
Initializes then starts the queue manager.
Definition: d2_process.cc:373
This file defines the class D2QueueMgr.
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)
Processes the given configuration.
Definition: d2_process.cc:232
This file defines the class D2UpdateMgr.
Application Process Interface.
Definition: d_process.h:81
void setShutdownType(const ShutdownType &value)
Sets the shutdown type to the given value.
Definition: d2_process.h:251
static const unsigned int QUEUE_RESTART_PERCENT
Defines the point at which to resume receiving requests.
Definition: d2_process.h:48
virtual size_t runIO()
Allows IO processing to run until at least callback is invoked.
Definition: d2_process.cc:125