Commit 1d9c696f authored by Marcin Siodelski's avatar Marcin Siodelski

[#92,!13] Moved CqlConnection and CqlExchange classes to libkea-cql.

parent b82d365b
......@@ -1575,6 +1575,8 @@ AC_CONFIG_FILES([Makefile
src/lib/mysql/Makefile
src/lib/pgsql/Makefile
src/lib/pgsql/tests/Makefile
src/lib/cql/Makefile
src/lib/cql/tests/Makefile
src/lib/process/Makefile
src/lib/process/tests/Makefile
src/lib/process/testutils/Makefile
......
......@@ -104,6 +104,9 @@ endif
if HAVE_PGSQL
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
......
......@@ -92,6 +92,9 @@ endif
if HAVE_PGSQL
d2_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
d2_unittests_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
d2_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
d2_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
......
......@@ -91,6 +91,9 @@ endif
if HAVE_PGSQL
kea_dhcp4_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
kea_dhcp4_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
kea_dhcp4_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -138,6 +138,9 @@ endif
if HAVE_PGSQL
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
......
......@@ -91,6 +91,9 @@ endif
if HAVE_PGSQL
kea_dhcp6_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
kea_dhcp6_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
kea_dhcp6_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -142,6 +142,9 @@ endif
if HAVE_PGSQL
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -68,6 +68,9 @@ endif
if HAVE_PGSQL
kea_lfc_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
kea_lfc_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
kea_lfc_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
......
......@@ -68,6 +68,9 @@ endif
if HAVE_PGSQL
lfc_unittests_LDADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
lfc_unittests_LDADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
lfc_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
......
......@@ -9,6 +9,10 @@ if HAVE_PGSQL
SUBDIRS += pgsql
endif
if HAVE_CQL
SUBDIRS += cql
endif
SUBDIRS += testutils hooks dhcp config stats asiodns dhcp_ddns eval \
dhcpsrv cfgrpt \
process http
SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES) $(CQL_CPPFLAGS)
AM_CXXFLAGS = $(KEA_CXXFLAGS)
CLEANFILES = *.gcno *.gcda
lib_LTLIBRARIES = libkea-cql.la
libkea_cql_la_SOURCES = cql_connection.cc cql_connection.h
libkea_cql_la_SOURCES += cql_exchange.cc cql_exchange.h
libkea_cql_la_SOURCES += sql_common.h
libkea_cql_la_LIBADD = $(top_builddir)/src/lib/database/libkea-database.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
libkea_cql_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_cql_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
libkea_cql_la_LDFLAGS = -no-undefined -version-info 0:0:0
libkea_cql_la_LDFLAGS += $(CQL_LIBS)
# Specify the headers for copying into the installation directory tree.
libkea_cql_includedir = $(pkgincludedir)/cql
libkea_cql_include_HEADERS = \
cql_connection.h \
cql_exchange.h \
sql_common.h
......@@ -18,17 +18,15 @@
#include <config.h>
#include <cql/cql_connection.h>
#include <cql/cql_exchange.h>
#include <database/db_exceptions.h>
#include <database/db_log.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_exchange.h>
#include <string>
using namespace isc::db;
namespace isc {
namespace dhcp {
namespace db {
CqlConnection::CqlConnection(const ParameterMap& parameters)
: DatabaseConnection(parameters), statements_(), cluster_(NULL),
......
......@@ -32,7 +32,7 @@
#include <vector>
namespace isc {
namespace dhcp {
namespace db {
/// @brief Pair containing major and minor versions
/// @todo: This is already defined in lease_mgr.h. Need to have one
......@@ -211,7 +211,7 @@ public:
typedef std::shared_ptr<CqlConnection> CqlConnectionPtr;
} // namespace dhcp
} // namespace db
} // namespace isc
#endif // CQL_CONNECTION_H
......@@ -18,10 +18,10 @@
#include <config.h>
#include <cql/cql_connection.h>
#include <cql/cql_exchange.h>
#include <cql/sql_common.h>
#include <database/db_exceptions.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_exchange.h>
#include <dhcpsrv/sql_common.h>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
......@@ -37,10 +37,8 @@
#include <utility>
#include <vector>
using namespace isc::db;
namespace isc {
namespace dhcp {
namespace db {
/// @brief Macro to return directly from caller function
#define KEA_CASS_CHECK(cass_error) \
......@@ -1007,5 +1005,5 @@ CqlVersionExchange::retrieveVersion(const CqlConnection& connection) {
return VersionPair();
}
} // namespace dhcp
} // namespace db
} // namespace isc
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-2017 Deutsche Telekom AG.
//
// Authors: Razvan Becheriu <razvan.becheriu@qualitance.com>
......@@ -18,8 +19,8 @@
#ifndef CQL_EXCHANGE_H
#define CQL_EXCHANGE_H
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/sql_common.h>
#include <cql/cql_connection.h>
#include <cql/sql_common.h>
#include <boost/any.hpp> // for boost::any
......@@ -30,7 +31,7 @@
#include <vector>
namespace isc {
namespace dhcp {
namespace db {
/// @brief Host identifier converted to Cassandra data type
typedef std::vector<cass_byte_t> CassBlob;
......@@ -318,7 +319,7 @@ exchangeType(const boost::any& object);
ExchangeDataType
exchangeType(const CassValueType& type);
} // namespace dhcp
} // namespace db
} // namespace isc
#endif // CQL_EXCHANGE_H
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-2017 Deutsche Telekom AG.
//
// Author: Cristian Secăreanu <cristian.secareanu@qualitance.com>
......@@ -18,7 +19,7 @@
#define SQL_COMMON_H
namespace isc {
namespace dhcp {
namespace db {
/// @brief Used to map server data types with internal backend storage data
/// types.
......@@ -49,7 +50,7 @@ public:
}
};
} // namespace dhcp
} // namespace db
} // namespace isc
#endif // SQL_COMMON_H
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += libcql_unittests
libcql_unittests_SOURCES = cql_connection_unittest.cc
libcql_unittests_SOURCES += run_unittests.cc
libcql_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(CQL_CPPFLAGS)
libcql_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) $(CQL_LIBS)
libcql_unittests_LDADD = $(top_builddir)/src/lib/cql/libkea-cql.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libcql_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(GTEST_LDADD)
endif
noinst_PROGRAMS = $(TESTS)
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017 Deutsche Telekom AG.
//
// This Source Code Form is subject to the terms of the Mozilla Public
......@@ -6,8 +7,8 @@
#include <config.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_exchange.h>
#include <cql/cql_connection.h>
#include <cql/cql_exchange.h>
#include <cstring>
......@@ -17,11 +18,11 @@
namespace {
using isc::dhcp::CqlTaggedStatement;
using isc::dhcp::StatementMap;
using isc::dhcp::StatementTag;
using isc::dhcp::StatementTagHash;
using isc::dhcp::exchangeType;
using isc::db::CqlTaggedStatement;
using isc::db::StatementMap;
using isc::db::StatementTag;
using isc::db::StatementTagHash;
using isc::db::exchangeType;
class CqlConnectionTest {
public:
......
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <log/logger_support.h>
#include <gtest/gtest.h>
int
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
isc::log::initLogger();
int result = RUN_ALL_TESTS();
return (result);
}
......@@ -134,7 +134,6 @@ libkea_dhcpsrv_la_SOURCES += logging.cc logging.h
libkea_dhcpsrv_la_SOURCES += logging_info.cc logging_info.h
libkea_dhcpsrv_la_SOURCES += memfile_lease_mgr.cc memfile_lease_mgr.h
libkea_dhcpsrv_la_SOURCES += memfile_lease_storage.h
libkea_dhcpsrv_la_SOURCES += sql_common.h
if HAVE_MYSQL
libkea_dhcpsrv_la_SOURCES += mysql_lease_mgr.cc mysql_lease_mgr.h
......@@ -151,8 +150,6 @@ libkea_dhcpsrv_la_SOURCES += pgsql_lease_mgr.cc pgsql_lease_mgr.h
endif
if HAVE_CQL
libkea_dhcpsrv_la_SOURCES += cql_connection.cc cql_connection.h
libkea_dhcpsrv_la_SOURCES += cql_exchange.cc cql_exchange.h
libkea_dhcpsrv_la_SOURCES += cql_host_data_source.cc cql_host_data_source.h
libkea_dhcpsrv_la_SOURCES += cql_lease_mgr.cc cql_lease_mgr.h
endif
......@@ -219,6 +216,9 @@ endif
if HAVE_PGSQL
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
......@@ -302,7 +302,6 @@ libkea_dhcpsrv_include_HEADERS = \
network_state.h \
pool.h \
shared_network.h \
sql_common.h \
srv_config.h \
subnet.h \
subnet_id.h \
......@@ -314,8 +313,6 @@ libkea_dhcpsrv_include_HEADERS = \
if HAVE_CQL
libkea_dhcpsrv_include_HEADERS += \
cql_connection.h \
cql_exchange.h \
cql_host_data_source.h \
cql_lease_mgr.h
endif
......
......@@ -17,6 +17,7 @@
#include <config.h>
#include <cql/cql_exchange.h>
#include <database/db_exceptions.h>
#include <dhcpsrv/cql_host_data_source.h>
#include <dhcp/duid.h>
......@@ -25,7 +26,6 @@
#include <dhcp/option_definition.h>
#include <dhcpsrv/cfg_option.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/cql_exchange.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <util/buffer.h>
#include <util/hash.h>
......
......@@ -18,8 +18,8 @@
#ifndef CQL_HOST_DATA_SOURCE_H
#define CQL_HOST_DATA_SOURCE_H
#include <cql/cql_connection.h>
#include <dhcpsrv/base_host_data_source.h>
#include <dhcpsrv/cql_connection.h>
#include <string>
#include <vector>
......@@ -281,7 +281,7 @@ public:
///
/// @throw isc::db::DbOperationError An operation on the open database
/// has failed.
virtual VersionPair getVersion() const;
virtual db::VersionPair getVersion() const;
/// @brief Commit Transactions
///
......
......@@ -19,9 +19,9 @@
#ifndef CQL_LEASE_MGR_H
#define CQL_LEASE_MGR_H
#include <cql/cql_connection.h>
#include <cql/cql_exchange.h>
#include <dhcp/hwaddr.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_exchange.h>
#include <dhcpsrv/dhcpsrv_exceptions.h>
#include <dhcpsrv/lease_mgr.h>
......@@ -34,11 +34,6 @@
namespace isc {
namespace dhcp {
class CqlVersionExchange;
class CqlLeaseExchange;
class CqlLease4Exchange;
class CqlLease6Exchange;
/// @brief Cassandra Lease Manager
///
/// This class provides the @ref isc::dhcp::LeaseMgr interface to the Cassandra
......@@ -568,7 +563,7 @@ public:
private:
/// @brief Database connection object
mutable CqlConnection dbconn_;
mutable db::CqlConnection dbconn_;
};
} // namespace dhcp
......
......@@ -15,7 +15,6 @@
#include <dhcp/hwaddr.h>
#include <dhcpsrv/lease.h>
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/sql_common.h>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -114,7 +114,6 @@ libdhcpsrv_unittests_SOURCES += pgsql_lease_mgr_unittest.cc
libdhcpsrv_unittests_SOURCES += pgsql_host_data_source_unittest.cc
endif
if HAVE_CQL
libdhcpsrv_unittests_SOURCES += cql_connection_unittest.cc
libdhcpsrv_unittests_SOURCES += cql_lease_mgr_unittest.cc
libdhcpsrv_unittests_SOURCES += cql_host_data_source_unittest.cc
endif
......
......@@ -17,12 +17,12 @@
#include <config.h>
#include <exceptions/exceptions.h>
#include <asiolink/io_address.h>
#include <exceptions/exceptions.h>
#include <cql/cql_connection.h>
#include <dhcpsrv/host.h>
#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/host_data_source_factory.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_lease_mgr.h>
#include <dhcpsrv/cql_host_data_source.h>
#include <dhcpsrv/testutils/cql_schema.h>
......
......@@ -19,8 +19,8 @@
#include <config.h>
#include <asiolink/io_address.h>
#include <cql/cql_connection.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/cql_connection.h>
#include <dhcpsrv/cql_lease_mgr.h>
#include <dhcpsrv/tests/test_utils.h>
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
......
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -8,7 +8,7 @@
#include <cassandra.h>
#include <dhcpsrv/cql_connection.h>
#include <cql/cql_connection.h>
#include <dhcpsrv/testutils/cql_schema.h>
#include <stdlib.h>
......
......@@ -24,6 +24,6 @@ libkea_mysql_la_LDFLAGS = -no-undefined -version-info 0:0:0
libkea_mysql_la_LDFLAGS += $(MYSQL_LIBS)
# Specify the headers for copying into the installation directory tree.
libkea_mysql_includedir = $(pkgincludedir)/database
libkea_mysql_includedir = $(pkgincludedir)/mysql
libkea_mysql_include_HEADERS = \
mysql_connection.h
......@@ -26,6 +26,7 @@ libkea_pgsql_la_LDFLAGS = -no-undefined -version-info 0:0:0
libkea_pgsql_la_LDFLAGS += $(PGSQL_LIBS)
# Specify the headers for copying into the installation directory tree.
libkea_pgsql_includedir = $(pkgincludedir)/database
libkea_pgsql_includedir = $(pkgincludedir)/pgsql
libkea_pgsql_include_HEADERS = \
pgsql_connection.h
pgsql_connection.h \
pgsql_exchange.h
......@@ -62,6 +62,9 @@ endif
if HAVE_PGSQL
libkea_process_la_LIBADD += $(top_builddir)/src/lib/pgsql/libkea-pgsql.la
endif
if HAVE_CQL
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cql/libkea-cql.la
endif
libkea_process_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
libkea_process_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment