Kea  1.5.0
d2_process.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2017 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 {
39  SD_NOW
40  };
41 
48  static const unsigned int QUEUE_RESTART_PERCENT;
49 
61  D2Process(const char* name, const asiolink::IOServicePtr& io_service);
62 
74  virtual void init();
75 
107  virtual void run();
108 
136 
162  bool check_only = false);
163 
165  virtual ~D2Process();
166 
167 protected:
196  virtual void checkQueueStatus();
197 
206  virtual void reconfigureQueueMgr();
207 
228  virtual size_t runIO();
229 
237  virtual bool canShutdown() const;
238 
244  void setReconfQueueFlag(const bool value) {
245  reconf_queue_flag_ = value;
246  }
247 
253  void setShutdownType(const ShutdownType& value) {
254  shutdown_type_ = value;
255  }
256 
257 public:
262 
264  const D2QueueMgrPtr& getD2QueueMgr() const {
265  return (queue_mgr_);
266  }
267 
270  return (update_mgr_);
271  }
272 
274  bool getReconfQueueFlag() const {
275  return (reconf_queue_flag_);
276  }
277 
282  return (shutdown_type_);
283  }
284 
291  static const char* getShutdownTypeStr(const ShutdownType& type);
292 
293 private:
295  D2QueueMgrPtr queue_mgr_;
296 
298  D2UpdateMgrPtr update_mgr_;
299 
301  bool reconf_queue_flag_;
302 
304  ShutdownType shutdown_type_;
305 };
306 
308 typedef boost::shared_ptr<D2Process> D2ProcessPtr;
309 
310 }; // namespace isc::d2
311 }; // namespace isc
312 
313 #endif
isc::d2::D2Process::SD_NORMAL
@ SD_NORMAL
Definition: d2_process.h:37
d_process.h
isc::d2::D2CfgMgrPtr
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
Definition: d2_cfg_mgr.h:297
isc::d2::D2Process::canShutdown
virtual bool canShutdown() const
Indicates whether or not the process can perform a shutdown.
Definition: d2_process.cc:115
d2_update_mgr.h
isc::d2::D2QueueMgrPtr
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
Definition: d2_queue_mgr.h:343
isc::d2::D2Process::~D2Process
virtual ~D2Process()
Destructor.
Definition: d2_process.cc:365
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::d2::D2ProcessPtr
boost::shared_ptr< D2Process > D2ProcessPtr
Defines a shared pointer to D2Process.
Definition: d2_process.h:308
isc::d2::D2Process
DHCP-DDNS Application Process.
Definition: d2_process.h:24
isc::d2::D2Process::setShutdownType
void setShutdownType(const ShutdownType &value)
Sets the shutdown type to the given value.
Definition: d2_process.h:253
isc::d2::D2Process::D2Process
D2Process(const char *name, const asiolink::IOServicePtr &io_service)
Constructor.
Definition: d2_process.cc:23
isc::d2::D2Process::getD2CfgMgr
D2CfgMgrPtr getD2CfgMgr()
Returns a pointer to the configuration manager.
Definition: d2_process.cc:369
isc::d2::D2Process::shutdown
virtual isc::data::ConstElementPtr shutdown(isc::data::ConstElementPtr args)
Initiates the D2Process shutdown process.
Definition: d2_process.cc:160
isc::d2::D2Process::runIO
virtual size_t runIO()
Allows IO processing to run until at least callback is invoked.
Definition: d2_process.cc:88
isc::d2::D2Process::getReconfQueueFlag
bool getReconfQueueFlag() const
Returns true if the queue manager should be reconfigured.
Definition: d2_process.h:274
isc::process::DProcessBase
Application Process Interface.
Definition: d_process.h:67
isc::d2::D2Process::reconfigureQueueMgr
virtual void reconfigureQueueMgr()
Initializes then starts the queue manager.
Definition: d2_process.cc:315
isc::d2::D2Process::run
virtual void run()
Implements the process's event loop.
Definition: d2_process.cc:46
d2_queue_mgr.h
isc::d2::D2Process::getShutdownType
ShutdownType getShutdownType() const
Returns the type of shutdown requested.
Definition: d2_process.h:281
isc::d2::D2Process::setReconfQueueFlag
void setReconfQueueFlag(const bool value)
Sets queue reconfigure indicator to the given value.
Definition: d2_process.h:244
isc::d2::D2Process::configure
virtual isc::data::ConstElementPtr configure(isc::data::ConstElementPtr config_set, bool check_only=false)
Processes the given configuration.
Definition: d2_process.cc:195
isc::d2::D2Process::checkQueueStatus
virtual void checkQueueStatus()
Monitors current queue manager state, takes action accordingly.
Definition: d2_process.cc:238
isc::d2::D2Process::SD_DRAIN_FIRST
@ SD_DRAIN_FIRST
Definition: d2_process.h:38
isc::d2::D2Process::ShutdownType
ShutdownType
Defines the shutdown types supported by D2Process.
Definition: d2_process.h:36
isc::d2::D2Process::getD2QueueMgr
const D2QueueMgrPtr & getD2QueueMgr() const
Returns a reference to the queue manager.
Definition: d2_process.h:264
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::d2::D2Process::getShutdownTypeStr
static const char * getShutdownTypeStr(const ShutdownType &type)
Returns a text label for the given shutdown type.
Definition: d2_process.cc:376
isc::d2::D2Process::getD2UpdateMgr
const D2UpdateMgrPtr & getD2UpdateMgr() const
Returns a reference to the update manager.
Definition: d2_process.h:269
isc::d2::D2Process::QUEUE_RESTART_PERCENT
static const unsigned int QUEUE_RESTART_PERCENT
Defines the point at which to resume receiving requests.
Definition: d2_process.h:48
isc::d2::D2Process::init
virtual void init()
Called after instantiation to perform initialization unique to D2.
Definition: d2_process.cc:42
isc::d2::D2UpdateMgrPtr
boost::shared_ptr< D2UpdateMgr > D2UpdateMgrPtr
Defines a pointer to a D2UpdateMgr instance.
Definition: d2_update_mgr.h:251
isc::d2::D2Process::SD_NOW
@ SD_NOW
Definition: d2_process.h:39