19#include <boost/algorithm/string.hpp>
34boost::scoped_ptr<TrackingLeaseMgr>&
35LeaseMgrFactory::getLeaseMgrPtr() {
36 static boost::scoped_ptr<TrackingLeaseMgr> lease_mgr_ptr;
37 return (lease_mgr_ptr);
42 const std::string type =
"type";
49 if (parameters.find(type) == parameters.end()) {
52 "contain the 'type' keyword");
57 if (parameters[type] ==
string(
"mysql")) {
65 "support for database type: mysql");
69 if (parameters[type] ==
string(
"postgresql")) {
77 "support for database type: postgresql");
80 if (parameters[type] ==
string(
"memfile")) {
89 "not specify a supported database backend: " << parameters[type]);
96 if (getLeaseMgrPtr()) {
98 .arg(getLeaseMgrPtr()->getType());
100 getLeaseMgrPtr().reset();
124 return (getLeaseMgrPtr().get());
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
static std::string redactedAccessString(const ParameterMap ¶meters)
Redact database access string.
static ParameterMap parse(const std::string &dbaccess)
Parse database access string.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
static void create(const std::string &dbaccess)
Create an instance of a lease manager.
static TrackingLeaseMgr & instance()
Return current lease manager.
static void destroy()
Destroy lease manager.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
static void recreate(const std::string &dbaccess, bool preserve_callbacks=true)
Recreate an instance of a lease manager with optionally preserving registered callbacks.
Concrete implementation of a lease database backend using flat file.
No lease manager exception.
PostgreSQL Lease Manager.
Introduces callbacks into the LeaseMgr.
boost::shared_ptr< CallbackContainer > CallbackContainerPtr
Pointer to the callback container.
CallbackContainerPtr callbacks_
The multi-index container holding registered callbacks.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
const isc::log::MessageID DHCPSRV_MEMFILE_DB
const isc::log::MessageID DHCPSRV_PGSQL_DB
const isc::log::MessageID DHCPSRV_CLOSE_DB
const isc::log::MessageID DHCPSRV_UNKNOWN_DB
const isc::log::MessageID DHCPSRV_NOTYPE_DB
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
const isc::log::MessageID DHCPSRV_MYSQL_DB
Defines the logger used by the top-level component of kea-lfc.