Kea
1.9.9-git
|
Server selector for associating objects in a database with specific servers. More...
#include <server_selector.h>
Public Types | |
enum | Type { Type::UNASSIGNED, Type::ALL, Type::SUBSET, Type::ANY } |
Type of the server selection. More... | |
Public Member Functions | |
bool | amAll () const |
Convenience method checking if the server selector is "all". More... | |
bool | amAny () const |
Convenience method checking if the server selector is "any". More... | |
bool | amUnassigned () const |
Convenience method checking if the server selector is "unassigned". More... | |
std::set< data::ServerTag > | getTags () const |
Returns tags associated with the selector. More... | |
Type | getType () const |
Returns type of the selector. More... | |
bool | hasMultipleTags () const |
Convenience method checking if the server selector has multiple tags. More... | |
bool | hasNoTags () const |
Convenience method checking if the server selector has no tags. More... | |
Static Public Member Functions | |
static ServerSelector | ALL () |
Factory returning "all servers" selector. More... | |
static ServerSelector | ANY () |
Factory returning "any server" selector. More... | |
static ServerSelector | MULTIPLE (const std::set< std::string > &server_tags) |
Factory returning "multiple servers" selector. More... | |
static ServerSelector | ONE (const std::string &server_tag) |
Factory returning selector of one server. More... | |
static ServerSelector | UNASSIGNED () |
Factory returning "unassigned" server selector. More... | |
Server selector for associating objects in a database with specific servers.
Configuration information stored in the configuration backends can be associated with selected servers, all servers or no particular server. For example: a particular subnet definition in the database may be associated with one server or can be shared by multiple servers. In the latter case, a subnet may be associated with a subset of servers or all servers. An administrator may also add the configuration data into the database and do not associate this data with any particular server.
When fetching the configuration data from a database or when storing data in the database there is a need to specify which servers this data is associated with. The ServerSelector
class represents such associations.
It includes three modes of selection: UNASSIGNED, ALL and SUBSET and several factory functions making associations described above.
The ServerSelector
class should be used in objects derived from BaseConfigBackendPool
and in objects derived from BaseConfigBackend
to indicate which servers the specific calls exposed by these objects refer to.
Definition at line 46 of file server_selector.h.
|
strong |
Type of the server selection.
Enumerator | |
---|---|
UNASSIGNED | |
ALL | |
SUBSET | |
ANY |
Definition at line 50 of file server_selector.h.
|
inlinestatic |
Factory returning "all servers" selector.
Definition at line 64 of file server_selector.h.
References ALL.
Referenced by isc::process::CBControlBase< ConfigBackendDHCPv4Mgr >::databaseConfigFetch().
|
inline |
Convenience method checking if the server selector is "all".
Definition at line 119 of file server_selector.h.
References ALL, and getType().
|
inline |
Convenience method checking if the server selector is "any".
Definition at line 126 of file server_selector.h.
References ANY, and getType().
|
inline |
Convenience method checking if the server selector is "unassigned".
Definition at line 112 of file server_selector.h.
References getType(), and UNASSIGNED.
|
inlinestatic |
Factory returning "any server" selector.
Definition at line 84 of file server_selector.h.
References ANY.
|
inline |
Returns tags associated with the selector.
Definition at line 98 of file server_selector.h.
|
inline |
Returns type of the selector.
Definition at line 90 of file server_selector.h.
Referenced by amAll(), amAny(), and amUnassigned().
|
inline |
Convenience method checking if the server selector has multiple tags.
Definition at line 133 of file server_selector.h.
|
inline |
Convenience method checking if the server selector has no tags.
Definition at line 105 of file server_selector.h.
|
static |
Factory returning "multiple servers" selector.
server_tags | set of server tags to be selected. |
InvalidOperation | if no server tags provided. |
Definition at line 18 of file server_selector.cc.
References isc_throw.
|
inlinestatic |
Factory returning selector of one server.
server_tag | tag of the single server to be selected. |
Definition at line 72 of file server_selector.h.
Referenced by isc::process::CBControlBase< ConfigBackendDHCPv4Mgr >::databaseConfigFetch().
|
inlinestatic |
Factory returning "unassigned" server selector.
Definition at line 58 of file server_selector.h.
References UNASSIGNED.