Kea: server_collection.cc Source File

| Kea 3.2.0-git

server_collection.cc
Go to the documentation of this file.
1// Copyright (C) 2019-2020 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#include <config.h>
8
9#include <database/server_collection.h>
10
11using namespace isc::data;
12
13namespace isc {
14namespace db {
15
16 ServerPtr
17ServerFetcher::get(const ServerCollection& collection,
18 const ServerTag& server_tag) {
19 auto& index = collection.get<ServerTagIndexTag>();
20 auto s = index.find(server_tag.get());
21 if (s != index.end()) {
22 return (*s);
23 }
24 return (ServerPtr());
25}
26
27} // end of namespace isc::db
28} // end of namespace isc
isc::data::ServerTag
Represents a server tag.
Definition server_tag.h:25
isc::data::ServerTag::get
std::string get() const
Returns server tag as string.
Definition server_tag.h:51
isc::db::ServerFetcher::get
static ServerPtr get(const ServerCollection &collection, const data::ServerTag &server_tag)
Fetches server from the collection by tag.
Definition server_collection.cc:17
isc::data
Definition base_stamped_element.cc:12
isc::db
Definition audit_entry.cc:14
isc::db::ServerPtr
boost::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition server.h:22
isc::db::ServerCollection
boost::multi_index_container< ServerPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< ServerTagIndexTag >, boost::multi_index::const_mem_fun< Server, std::string, &Server::getServerTagAsText > > > > ServerCollection
Multi index container for Server.
Definition server_collection.h:35
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
server_collection.h
isc::db::ServerTagIndexTag
Tag identifying an index by server tag.
Definition server_collection.h:20