Commit 5acc3454 authored by Steven Murray's avatar Steven Murray
Browse files

Split cta::catalogue into cta::catalogue and cta::rdbms

parent 51c159dc
......@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/NullDbValue.hpp"
#include "catalogue/OcciRset.hpp"
#include "catalogue/OcciStmt.hpp"
#include "NullDbValue.hpp"
#include "OcciRset.hpp"
#include "OcciStmt.hpp"
#include "common/exception/Exception.hpp"
#include "common/utils/utils.hpp"
......@@ -27,7 +27,7 @@
#include <stdexcept>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// constructor
......@@ -185,5 +185,5 @@ optional<uint64_t> OcciRset::columnOptionalUint64(const std::string &colName) co
}
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -18,15 +18,15 @@
#pragma once
#include "catalogue/ColumnNameToIdx.hpp"
#include "catalogue/DbRset.hpp"
#include "ColumnNameToIdx.hpp"
#include "DbRset.hpp"
#include <memory>
#include <mutex>
#include <occi.h>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* Forward declaration to avoid a circular dependency between OcciRset and
......@@ -149,5 +149,5 @@ private:
}; // class OcciRset
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/OcciConn.hpp"
#include "catalogue/OcciRset.hpp"
#include "catalogue/OcciStmt.hpp"
#include "OcciConn.hpp"
#include "OcciRset.hpp"
#include "OcciStmt.hpp"
#include "common/exception/Exception.hpp"
#include <cstring>
......@@ -28,7 +28,7 @@
#include <stdexcept>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// constructor
......@@ -164,5 +164,5 @@ oracle::occi::Statement *OcciStmt::operator->() const {
return get();
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -18,8 +18,8 @@
#pragma once
#include "catalogue/DbStmt.hpp"
#include "catalogue/ParamNameToIdx.hpp"
#include "DbStmt.hpp"
#include "ParamNameToIdx.hpp"
#include <memory>
#include <mutex>
......@@ -27,7 +27,7 @@
#include <stdint.h>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* Forward declaration to avoid a circular dependency between OcciStmt and
......@@ -158,5 +158,5 @@ private:
}; // class OcciStmt
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,13 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/ParamNameToIdx.hpp"
#include "ParamNameToIdx.hpp"
#include "common/exception/Exception.hpp"
#include <sstream>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// constructor
......@@ -90,5 +90,5 @@ unsigned int ParamNameToIdx::getIdx(const std::string &paramName) const {
return itor->second;
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -20,7 +20,7 @@
#include <string>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* Map from SQL parameter name to parameter index.
......@@ -64,5 +64,5 @@ private:
}; // class ParamNameToIdx
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/ParamNameToIdx.hpp"
#include "ParamNameToIdx.hpp"
#include "common/exception/Exception.hpp"
#include <gtest/gtest.h>
......@@ -24,7 +24,7 @@
namespace unitTests {
class cta_catalogue_ParamNameToIdxTest : public ::testing::Test {
class cta_rdbms_ParamNameToIdxTest : public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -34,8 +34,8 @@ protected:
}
};
TEST_F(cta_catalogue_ParamNameToIdxTest, getIdx_existing_params) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_ParamNameToIdxTest, getIdx_existing_params) {
using namespace cta::rdbms;
const char *const sql =
"INSERT INTO ADMIN_USER("
......@@ -80,9 +80,9 @@ TEST_F(cta_catalogue_ParamNameToIdxTest, getIdx_existing_params) {
ASSERT_EQ(10, paramNameToIdx.getIdx(":LAST_UPDATE_TIME"));
}
TEST_F(cta_catalogue_ParamNameToIdxTest, getIdx_non_existing_param) {
TEST_F(cta_rdbms_ParamNameToIdxTest, getIdx_non_existing_param) {
using namespace cta;
using namespace cta::catalogue;
using namespace cta::rdbms;
const char *const sql =
"String containing no bind parameters";
......
......@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/DbStmt.hpp"
#include "DbStmt.hpp"
#include "catalogue/RdbmsCatalogueSchema.hpp"
#include "catalogue/Sqlite.hpp"
#include "catalogue/SqliteConn.hpp"
#include "Sqlite.hpp"
#include "SqliteConn.hpp"
#include "common/exception/Exception.hpp"
#include <memory>
#include <sstream>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// rcToStr
......@@ -95,5 +95,5 @@ std::string Sqlite::rcToStr(const int rc) {
}
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -22,7 +22,7 @@
#include <string>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* A helper class for working with SQLite.
......@@ -40,5 +40,5 @@ public:
}; // class SqlLiteStmt
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -17,15 +17,15 @@
*/
#include "catalogue/RdbmsCatalogueSchema.hpp"
#include "catalogue/SqliteConn.hpp"
#include "catalogue/SqliteStmt.hpp"
#include "SqliteConn.hpp"
#include "SqliteStmt.hpp"
#include "common/exception/Exception.hpp"
#include <stdexcept>
#include <string>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// constructor
......@@ -148,5 +148,5 @@ void SqliteConn::printSchema(std::ostream &os) {
}
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -18,13 +18,13 @@
#pragma once
#include "catalogue/DbConn.hpp"
#include "DbConn.hpp"
#include <mutex>
#include <sqlite3.h>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* Forward declaration to avoid a circular dependency between SqliteConn and
......@@ -104,5 +104,5 @@ private:
}; // class SqliteConn
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,10 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/NullDbValue.hpp"
#include "catalogue/Sqlite.hpp"
#include "catalogue/SqliteRset.hpp"
#include "catalogue/SqliteStmt.hpp"
#include "NullDbValue.hpp"
#include "Sqlite.hpp"
#include "SqliteRset.hpp"
#include "SqliteStmt.hpp"
#include "common/exception/Exception.hpp"
#include <cstring>
......@@ -28,7 +28,7 @@
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* A map from column name to column index and type.
......@@ -241,5 +241,5 @@ optional<uint64_t> SqliteRset::columnOptionalUint64(const std::string &colName)
}
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -18,15 +18,15 @@
#pragma once
#include "catalogue/ColumnNameToIdxAndType.hpp"
#include "catalogue/DbRset.hpp"
#include "ColumnNameToIdxAndType.hpp"
#include "DbRset.hpp"
#include <memory>
#include <stdint.h>
#include <sqlite3.h>
namespace cta {
namespace catalogue {
namespace rdbms {
/**
* Forward declaration.
......@@ -118,5 +118,5 @@ private:
}; // class SqlLiteRset
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,10 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/Sqlite.hpp"
#include "catalogue/SqliteConn.hpp"
#include "catalogue/SqliteRset.hpp"
#include "catalogue/SqliteStmt.hpp"
#include "Sqlite.hpp"
#include "SqliteConn.hpp"
#include "SqliteRset.hpp"
#include "SqliteStmt.hpp"
#include "common/exception/Exception.hpp"
#include <cstring>
......@@ -27,7 +27,7 @@
#include <string>
namespace cta {
namespace catalogue {
namespace rdbms {
//------------------------------------------------------------------------------
// constructor
......@@ -144,5 +144,5 @@ uint64_t SqliteStmt::getNbAffectedRows() const {
return m_nbAffectedRows;
}
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -18,8 +18,8 @@
#pragma once
#include "catalogue/DbStmt.hpp"
#include "catalogue/ParamNameToIdx.hpp"
#include "DbStmt.hpp"
#include "ParamNameToIdx.hpp"
#include <map>
#include <memory>
......@@ -28,7 +28,7 @@
#include <sqlite3.h>
namespace cta {
namespace catalogue {
namespace rdbms {
class SqliteConn;
class SqliteRset;
......@@ -146,5 +146,5 @@ private:
}; // class SqlLiteStmt
} // namespace catalogue
} // namespace rdbms
} // namespace cta
......@@ -16,16 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "catalogue/SqliteConn.hpp"
#include "catalogue/SqliteRset.hpp"
#include "catalogue/SqliteStmt.hpp"
#include "SqliteConn.hpp"
#include "SqliteRset.hpp"
#include "SqliteStmt.hpp"
#include <gtest/gtest.h>
#include <memory>
namespace unitTests {
class cta_catalogue_SqliteStmtTest : public ::testing::Test {
class cta_rdbms_SqliteStmtTest : public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -35,8 +35,8 @@ protected:
}
};
TEST_F(cta_catalogue_SqliteStmtTest, create_table) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_SqliteStmtTest, create_table) {
using namespace cta::rdbms;
// Create a connection a memory resident database
SqliteConn conn(":memory:");
......@@ -86,8 +86,8 @@ TEST_F(cta_catalogue_SqliteStmtTest, create_table) {
}
}
TEST_F(cta_catalogue_SqliteStmtTest, select_from_empty_table) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_SqliteStmtTest, select_from_empty_table) {
using namespace cta::rdbms;
// Create a connection a memory resident database
SqliteConn conn(":memory:");
......@@ -117,8 +117,8 @@ TEST_F(cta_catalogue_SqliteStmtTest, select_from_empty_table) {
}
}
TEST_F(cta_catalogue_SqliteStmtTest, insert_without_bind) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_SqliteStmtTest, insert_without_bind) {
using namespace cta::rdbms;
// Create a connection a memory resident database
SqliteConn conn(":memory:");
......@@ -173,8 +173,8 @@ TEST_F(cta_catalogue_SqliteStmtTest, insert_without_bind) {
}
}
TEST_F(cta_catalogue_SqliteStmtTest, insert_with_bind) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_SqliteStmtTest, insert_with_bind) {
using namespace cta::rdbms;
// Create a connection a memory resident database
SqliteConn conn(":memory:");
......@@ -233,8 +233,8 @@ TEST_F(cta_catalogue_SqliteStmtTest, insert_with_bind) {
}
}
TEST_F(cta_catalogue_SqliteStmtTest, isolated_transaction) {
using namespace cta::catalogue;
TEST_F(cta_rdbms_SqliteStmtTest, isolated_transaction) {
using namespace cta::rdbms;
const std::string dbFilename = "file::memory:?cache=shared";
......
......@@ -17,7 +17,7 @@
*/
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/DbConn.hpp"
#include "rdbms/DbConn.hpp"
#include "catalogue/RdbmsCatalogue.hpp"
#include "common/admin/AdminUser.hpp"
#include "common/admin/AdminHost.hpp"
......@@ -81,7 +81,7 @@ public:
const SchedulerTestParam &param = GetParam();
m_db = param.dbFactory.create();
catalogue::DbLogin catalogueLogin(catalogue::DbLogin::DBTYPE_IN_MEMORY, "", "", "");
rdbms::DbLogin catalogueLogin(rdbms::DbLogin::DBTYPE_IN_MEMORY, "", "", "");
m_catalogue.reset(catalogue::CatalogueFactory::create(catalogueLogin));
m_scheduler.reset(new cta::Scheduler(*m_catalogue, *m_db, 5, 2*1000*1000));
......
......@@ -39,9 +39,10 @@ namespace unitTests {
protected:
void SetUp() {
using namespace cta;
using namespace cta::catalogue;
DbLogin catalogueLogin(DbLogin::DBTYPE_IN_MEMORY, "", "", "");
rdbms::DbLogin catalogueLogin(rdbms::DbLogin::DBTYPE_IN_MEMORY, "", "", "");
m_catalogue.reset(CatalogueFactory::create(catalogueLogin));
}
......
......@@ -48,8 +48,8 @@
#include "castor/utils/SmartArrayPtr.hpp"
#include "castor/utils/utils.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "catalogue/Sqlite.hpp"
#include "catalogue/SqliteConn.hpp"
#include "rdbms/Sqlite.hpp"
#include "rdbms/SqliteConn.hpp"
#include "objectstore/BackendVFS.hpp"
#include "objectstore/BackendFactory.hpp"
#include "objectstore/BackendPopulator.hpp"
......@@ -569,7 +569,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
} catch (std::bad_cast &){}
cta::objectstore::BackendPopulator backendPopulator(*backend);
cta::OStoreDBWithAgent osdb(*backend, backendPopulator.getAgent());
const cta::catalogue::DbLogin catalogueLogin = cta::catalogue::DbLogin::parseFile("/etc/cta/cta_catalogue_db.conf");
const cta::rdbms::DbLogin catalogueLogin = cta::rdbms::DbLogin::parseFile("/etc/cta/cta_catalogue_db.conf");
std::unique_ptr<cta::catalogue::Catalogue> catalogue(cta::catalogue::CatalogueFactory::create(catalogueLogin));
cta::Scheduler scheduler(*catalogue, osdb, 5, 2*1000*1000); //TODO: we have hardcoded the mount policy parameters here temporarily we will remove them once we know where to put them
......
......@@ -267,7 +267,7 @@ XrdCtaFilesystem::XrdCtaFilesystem():
throw cta::exception::Exception(std::string("Failed to instantiate object representing CTA logging system: ")+ex.getMessage().str());
}
const catalogue::DbLogin catalogueLogin = catalogue::DbLogin::parseFile("/etc/cta/cta_catalogue_db.conf");
const rdbms::DbLogin catalogueLogin = rdbms::DbLogin::parseFile("/etc/cta/cta_catalogue_db.conf");
m_catalogue.reset(catalogue::CatalogueFactory::create(catalogueLogin));
m_scheduler.reset(new cta::Scheduler(*m_catalogue, m_scheddb, 5, 2*1000*1000));
......
Supports Markdown
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