![]() |
Kea
1.5.0
|
Base class for configuration backend pools. More...
#include <base_config_backend_pool.h>
Public Types | |
| typedef boost::shared_ptr< ConfigBackendType > | ConfigBackendTypePtr |
| Shared pointer to the Configuration Backend used. More... | |
Public Member Functions | |
| virtual | ~BaseConfigBackendPool () |
| Virtual destructor. More... | |
| void | addBackend (ConfigBackendTypePtr backend) |
| Adds a backend to the pool. More... | |
| void | delAllBackends () |
| Deletes all backends from the pool. More... | |
| void | delAllBackends (const std::string &db_type) |
| Deletes all backends of the given type from the pool. More... | |
Protected Member Functions | |
| template<typename ReturnValue , typename... FnPtrArgs, typename... Args> | |
| ReturnValue | createUpdateDeleteProperty (ReturnValue(ConfigBackendType::*MethodPointer)(const db::ServerSelector &, FnPtrArgs...), const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, Args... input) |
| Add, update or delete property from the backend. More... | |
| template<typename PropertyCollectionType > | |
| void | getAllPropertiesConst (PropertyCollectionType(ConfigBackendType::*MethodPointer)(const db::ServerSelector &) const, const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, PropertyCollectionType &properties) const |
| Retrieve all configuration properties from the pool. More... | |
| template<typename PropertyCollectionType , typename... FnPtrArgs, typename... Args> | |
| void | getMultiplePropertiesConst (PropertyCollectionType(ConfigBackendType::*MethodPointer)(const db::ServerSelector &, FnPtrArgs...) const, const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, PropertyCollectionType &properties, Args... input) const |
| Retrieve multiple configuration properties from the pool. More... | |
| template<typename PropertyType , typename... FnPtrArgs, typename... Args> | |
| void | getPropertyPtrConst (PropertyType(ConfigBackendType::*MethodPointer)(const db::ServerSelector &, FnPtrArgs...) const, const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, PropertyType &property, Args... input) const |
| Retrieve a single configuration property from the pool. More... | |
| std::list< ConfigBackendTypePtr > | selectBackends (const db::BackendSelector &backend_selector) const |
| Selects existing backends matching the selector. More... | |
Protected Attributes | |
| std::list< ConfigBackendTypePtr > | backends_ |
| Holds configuration backends belonging to the pool. More... | |
Base class for configuration backend pools.
Each Kea server supporting databases as a configuration repository can use multiple database instances simultaneously. A pool is a collection of database backends used by a particular server. Different Kea servers use different pools because they store and fetch different configuration information. For example: DHCPv4 server stores and fetches IPv4 subnets, and DHCPv6 server stores and fetches IPv6 subnets. Therefore, each pool type will expose a different API calls.
This template class is a base class for all pools used by various servers. It implements mechanisms for managing multiple backends and for forwarding API calls to one or many database backends depending on the selections made via BackendSelector class.
| ConfigBackendType | Type of the configuration backend. This must be a class deriving from BaseConfigBackend class. It is a class dedicated to a particular server type, e.g. DHCPv4 server, and from which database specific backends derive. |
Definition at line 43 of file base_config_backend_pool.h.
| typedef boost::shared_ptr<ConfigBackendType> isc::cb::BaseConfigBackendPool< ConfigBackendType >::ConfigBackendTypePtr |
Shared pointer to the Configuration Backend used.
Definition at line 47 of file base_config_backend_pool.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 50 of file base_config_backend_pool.h.
|
inline |
Adds a backend to the pool.
| backend | Pointer to a backend to be added. |
Definition at line 55 of file base_config_backend_pool.h.
|
inlineprotected |
Add, update or delete property from the backend.
This is a common method for storing a single configuration property in a database, updating an existing property or deleting the property. The server specific backends call this method. For example, the DHCPv6 configuration backend pool may use this function to implement a createUpdateSubnet6 method:
where ConfigBackendDHCPv6::createUpdateSubnet6 has the following signature:
The backend selector must point to exactly one backend. If more than one backend is selected, an exception is thrown. If no backend is selected an exception is thrown either.
| ReturnValue | Returned value, typically void or uint64_t. |
| FnPtrArgs | Parameter pack holding argument types of the backend method to be invoked. |
| Args | Parameter pack holding types of the arguments provided in the call to this method. |
| MethodPointer | Pointer to the backend method to be called. |
| backend_selector | Backend selector. |
| server_selector | Server selector. |
| input | Objects used as arguments to the backend method to be called. |
| db::NoSuchDatabase | if no database matching the given selector was found. |
| db::AmbiguousDatabase | if multiple databases matching the selector were found. |
Definition at line 360 of file base_config_backend_pool.h.
|
inline |
Deletes all backends from the pool.
Definition at line 60 of file base_config_backend_pool.h.
|
inline |
Deletes all backends of the given type from the pool.
| db_type | backend to remove |
Definition at line 67 of file base_config_backend_pool.h.
|
inlineprotected |
Retrieve all configuration properties from the pool.
This is a common method for retrieving all configuration properties from the databases. The server specific backends call this method to retrieve all objects of the same type. For example, the DHCPv4 configuration backend pool may use this function to implement a getAllSubnets4 method:
where ConfigBackendDHCPv4::getAllSubnets4 has the following signature:
If the backend selector is set to "unspecified", this method will iterate over existing backends and call the MethodPointer method on each backend. It will return the first non-empty list returned by one of the backends.
| PropertyCollectionType | Type of the container into which the properties are stored. |
| MethodPointer | Pointer to the backend method to be called. | |
| backend_selector | Backend selector. | |
| server_selector | Server selector. | |
| [out] | properties | Reference to the collection of retrieved properties. |
| db::NoSuchDatabase | if no database matching the given selector was found. |
Definition at line 282 of file base_config_backend_pool.h.
|
inlineprotected |
Retrieve multiple configuration properties from the pool.
This is a common method for retrieving multiple configuration properties from the databases. The server specific backends call this method to retrieve multiple objects of the same type. For example, the DHCPv6 configuration backend pool may use this function to implement a getSubnets6 method:
where ConfigBackendDHCPv6::getSubnets6 has the following signature:
If the backend selector is set to "unspecified", this method will iterate over existing backends and call the MethodPointer method on each backend. It will return the first non-empty list returned by one of the backends.
| PropertyCollectionType | Type of the container into which the properties are stored. |
| FnPtrArgs | Parameter pack holding argument types of the backend method to be invoked. |
| Args | Parameter pack holding types of the arguments provided in the call to this method. |
| MethodPointer | Pointer to the backend method to be called. | |
| backend_selector | Backend selector. | |
| server_selector | Server selector. | |
| [out] | properties | Reference to the collection of retrieved properties. |
| input | Values to be used as input to the backend call. |
| db::NoSuchDatabase | if no database matching the given selector was found. |
Definition at line 211 of file base_config_backend_pool.h.
|
inlineprotected |
Retrieve a single configuration property from the pool.
This is common method for retrieving a single configuration property from the databases. The server specific backends call this method to retrieve a single object. For example, the DHCPv4 configuration backend pool may use this function to implement a getSubnet4 method:
where ConfigBackendDHCPv4::getSubnet4 has the following signature:
If the backend selector is set to "unspecified", this method will iterate over the existing backends and call the MethodPointer method on each backend. It will return the first non-null (or non-zero) value returned by this call. For example: if the first backend returns non-null value, this value is returned via property argument and the calls for the rest of the backends are skipped.
| PropertyType | Type of the object returned by the backend call. |
| FnPtrArgs | Parameter pack holding argument types of the backend method to be invoked. |
| Args | Parameter pack holding types of the arguments provided in the call to this method. |
| MethodPointer | Pointer to the backend method to be called. | |
| backend_selector | Backend selector. | |
| server_selector | Server selector. | |
| [out] | property | Reference to the shared pointer where retrieved property should be assigned. |
| input | Values to be used as input to the backend call. |
| db::NoSuchDatabase | if no database matching the given selector was found. |
Definition at line 129 of file base_config_backend_pool.h.
|
inlineprotected |
Selects existing backends matching the selector.
This method selects backends matching the selector. If the selector is "unspecified" or there is no backend in the pool, an empty list is returned.
| backend_selector | Selector for which matching backends should be selected. |
Definition at line 385 of file base_config_backend_pool.h.
Referenced by isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::createUpdateDeleteProperty(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getAllPropertiesConst(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getMultiplePropertiesConst(), and isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getPropertyPtrConst().
|
protected |
Holds configuration backends belonging to the pool.
Definition at line 433 of file base_config_backend_pool.h.
Referenced by isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::addBackend(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::delAllBackends(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getAllPropertiesConst(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getMultiplePropertiesConst(), isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::getPropertyPtrConst(), and isc::cb::BaseConfigBackendPool< ConfigBackendDHCPv4 >::selectBackends().