Kea  1.5.0
isc::db::ServerSelector Class Reference

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 of the server selection. More...
 

Public Member Functions

bool amUnassigned () const
 Convenience method checking if the server selector is "unassigned". More...
 
std::set< std::string > getTags () const
 Returns tags associated with the selector. More...
 
Type getType () const
 Returns type of the selector. More...
 

Static Public Member Functions

static ServerSelectorALL ()
 Factory returning "all servers" selector. More...
 
static ServerSelectorMULTIPLE (const std::set< std::string > &server_tags)
 Factory returning "multiple servers" selector. More...
 
static ServerSelectorONE (const std::string &server_tag)
 Factory returning selector of one server. More...
 
static ServerSelectorUNASSIGNED ()
 Factory returning "unassigned" server selector. More...
 

Detailed Description

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 patrticular server.

When fetching the configuration data from a databse 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.

Todo:
Add server selector for selecting only those configuration elements that are associated with all servers (and not with any particular server tags). Translating this to SQL queries it would probably be an empty or non-existing server tag.

Definition at line 45 of file server_selector.h.

Member Enumeration Documentation

◆ Type

Type of the server selection.

Enumerator
UNASSIGNED 
ALL 
SUBSET 

Definition at line 49 of file server_selector.h.

Member Function Documentation

◆ ALL()

static ServerSelector& isc::db::ServerSelector::ALL ( )
inlinestatic

Factory returning "all servers" selector.

Definition at line 62 of file server_selector.h.

References ALL.

◆ amUnassigned()

bool isc::db::ServerSelector::amUnassigned ( ) const
inline

Convenience method checking if the server selector is "unassigned".

Returns
true if the selector is "unassigned", false otherwise.

Definition at line 99 of file server_selector.h.

References getType(), and UNASSIGNED.

+ Here is the call graph for this function:

◆ getTags()

std::set<std::string> isc::db::ServerSelector::getTags ( ) const
inline

Returns tags associated with the selector.

Returns
server tags for mutliple selections and for one server, empty set for all servers and and unassigned.

Definition at line 92 of file server_selector.h.

◆ getType()

Type isc::db::ServerSelector::getType ( ) const
inline

Returns type of the selector.

Definition at line 84 of file server_selector.h.

Referenced by amUnassigned().

◆ MULTIPLE()

static ServerSelector& isc::db::ServerSelector::MULTIPLE ( const std::set< std::string > &  server_tags)
inlinestatic

Factory returning "multiple servers" selector.

Parameters
server_tagsset of server tags to be selected.

Definition at line 78 of file server_selector.h.

◆ ONE()

static ServerSelector& isc::db::ServerSelector::ONE ( const std::string &  server_tag)
inlinestatic

Factory returning selector of one server.

Parameters
server_tagtag of the single server to be selected.

Definition at line 70 of file server_selector.h.

◆ UNASSIGNED()

static ServerSelector& isc::db::ServerSelector::UNASSIGNED ( )
inlinestatic

Factory returning "unassigned" server selector.

Definition at line 56 of file server_selector.h.

References UNASSIGNED.


The documentation for this class was generated from the following file: