Kea 1.5.0
cql_host_data_source.h
Go to the documentation of this file.
1// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
2// Copyright (C) 2016-2018 Deutsche Telekom AG.
3//
4// Author: Andrei Pavel <andrei.pavel@qualitance.com>
5//
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18#ifndef CQL_HOST_DATA_SOURCE_H
19#define CQL_HOST_DATA_SOURCE_H
20
21#include <cql/cql_connection.h>
23
24#include <string>
25#include <vector>
26
27namespace isc {
28namespace dhcp {
29
31class CqlHostDataSourceImpl;
32
57public:
87
91 virtual ~CqlHostDataSource();
92
103 virtual void add(const HostPtr& host) override;
104
114 virtual bool del(const SubnetID& subnet_id,
115 const asiolink::IOAddress& addr) override;
116
130 virtual bool del4(const SubnetID& subnet_id,
131 const Host::IdentifierType& identifier_type,
132 const uint8_t* identifier_begin,
133 const size_t identifier_len) override;
134
148 virtual bool del6(const SubnetID& subnet_id,
149 const Host::IdentifierType& identifier_type,
150 const uint8_t* identifier_begin,
151 const size_t identifier_len) override;
152
166 virtual ConstHostCollection
167 getAll(const Host::IdentifierType& identifier_type,
168 const uint8_t* identifier_begin,
169 const size_t identifier_len) const override;
170
179 virtual ConstHostCollection
180 getAll4(const asiolink::IOAddress& address) const override;
181
194 virtual ConstHostPtr get4(const SubnetID& subnet_id,
195 const Host::IdentifierType& identifier_type,
196 const uint8_t* identifier_begin,
197 const size_t identifier_len) const override;
198
209 virtual ConstHostPtr
210 get4(const SubnetID& subnet_id,
211 const asiolink::IOAddress& address) const override;
212
223 virtual ConstHostPtr get6(const SubnetID& subnet_id,
224 const Host::IdentifierType& identifier_type,
225 const uint8_t* identifier_begin,
226 const size_t identifier_len) const override;
227
237 virtual ConstHostPtr get6(const asiolink::IOAddress& prefix,
238 const uint8_t prefix_len) const override;
239
247 virtual ConstHostPtr
248 get6(const SubnetID& subnet_id,
249 const asiolink::IOAddress& address) const override;
250
258 virtual ConstHostCollection
259 getAllHosts() const;
260
264 virtual std::string getDescription() const;
265
269 virtual std::string getName() const;
270
274 virtual std::string getType() const override;
275
284 virtual db::VersionPair getVersion() const;
285
289 virtual void commit() override;
290
294 virtual void rollback() override;
295
296private:
299}; // class CqlHostDataSource
300
301} // namespace dhcp
302} // namespace isc
303
304#endif // CQL_HOST_DATA_SOURCE_H
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Base interface for the classes implementing simple data source for host reservations.
Implementation of the CqlHostDataSource.
Cassandra host data source.
virtual ConstHostCollection getAll(const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
Return all hosts connected to any subnet for which reservations have been made using a specified iden...
virtual bool del6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
Attempts to delete a host by (subnet-id6, identifier-type, identifier).
virtual void rollback() override
Rollback Transactions.
virtual ConstHostCollection getAll4(const asiolink::IOAddress &address) const override
Returns a collection of hosts using the specified IPv4 address.
virtual std::string getDescription() const
Returns textual description of the backend.
virtual ConstHostPtr get6(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
Returns a Host connected to an IPv6 subnet.
virtual std::string getName() const
Returns the name of the database.
virtual ConstHostPtr get4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const override
Retrieves a Host connected to an IPv4 subnet.
virtual ~CqlHostDataSource()
Virtual destructor.
virtual bool del4(const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) override
Attempts to delete a host by (subnet-id4, identifier-type, identifier).
virtual ConstHostCollection getAllHosts() const
Returns a collection of all the hosts.
virtual std::string getType() const override
Return backend type.
virtual void commit() override
Commit Transactions.
virtual void add(const HostPtr &host) override
Adds a new host to the collection.
virtual bool del(const SubnetID &subnet_id, const asiolink::IOAddress &addr) override
Attempts to delete a host by (subnet-id, address)
virtual db::VersionPair getVersion() const
Retrieves schema version from the DB.
IdentifierType
Type of the host identifier.
Definition: host.h:252
std::pair< uint32_t, uint32_t > VersionPair
Pair containing major and minor versions.
boost::shared_ptr< Host > HostPtr
Pointer to the Host object.
Definition: host.h:725
std::vector< ConstHostPtr > ConstHostCollection
Collection of the const Host objects.
Definition: host.h:731
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Definition: host.h:728
Defines the logger used by the top-level component of kea-dhcp-ddns.