}
void
-RotatingFile::open() {
+RotatingFile::open(ManagerID) {
if (isOpen() || MultiThreadingMgr::instance().isTestMode()) {
return;
}
/// it is created. If the file is already open, the method simply
/// returns.
///
+ /// @param id the forensic backend manager ID.
+ ///
/// @throw LegalLogMgrError if the file cannot be opened.
- virtual void open();
+ virtual void open(isc::dhcp::ManagerID id = 0);
/// @brief Closes the underlying file.
///
timer_name_ += "]DbReconnectTimer";
}
-void MySqlStore::open() {
+void MySqlStore::open(ManagerID id) {
LegalLogDbLogger pushed(mysql_legal_log_db_logger);
// Test schema version first.
std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
MYSQL_SCHEMA_VERSION_MINOR);
- LegalLogMgrPtr store = LegalLogMgrFactory::instance();
- LegalLogMgrFactory::instance().reset();
+ LegalLogMgrPtr store = LegalLogMgrFactory::instance(id);
+ LegalLogMgrFactory::instance(id).reset();
string timer_name;
bool retry = false;
<< db_version.second);
}
- LegalLogMgrFactory::instance() = store;
+ LegalLogMgrFactory::instance(id) = store;
// Create an initial context.
pool_.reset(new MySqlStoreContextPool());
///
/// Finally, all the SQL commands are pre-compiled.
///
+ /// @param id the forensic backend manager ID.
+ ///
/// @throw isc::db::DbOpenError Error opening the database
/// @throw isc::db::DbOperationError An operation on the open
/// database has failed.
- virtual void open();
+ virtual void open(ManagerID id = 0);
/// @brief Closes the store.
virtual void close();
timer_name_ += "]DbReconnectTimer";
}
-void PgSqlStore::open() {
+void PgSqlStore::open(ManagerID id) {
LegalLogDbLogger pushed(pgsql_legal_log_db_logger);
// Check TLS support.
pair<uint32_t, uint32_t> code_version(PGSQL_SCHEMA_VERSION_MAJOR,
PGSQL_SCHEMA_VERSION_MINOR);
- LegalLogMgrPtr store = LegalLogMgrFactory::instance();
- LegalLogMgrFactory::instance().reset();
+ LegalLogMgrPtr store = LegalLogMgrFactory::instance(id);
+ LegalLogMgrFactory::instance(id).reset();
string timer_name;
bool retry = false;
<< db_version.second);
}
- LegalLogMgrFactory::instance() = store;
+ LegalLogMgrFactory::instance(id) = store;
// Create an initial context.
pool_.reset(new PgSqlStoreContextPool());
///
/// Finally, all the SQL commands are pre-compiled.
///
+ /// @param id the forensic backend manager ID.
+ ///
/// @throw isc::db::DbOpenError Error opening the database
/// @throw isc::db::DbOperationError An operation on the open
/// database has failed.
- virtual void open();
+ virtual void open(ManagerID id = 0);
/// @brief Closes the store.
virtual void close();
/// @brief Defines a smart pointer to a LegalLogMgr.
typedef boost::shared_ptr<LegalLogMgr> LegalLogMgrPtr;
+/// @brief Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
+typedef uint64_t ManagerID;
+
/// @brief LegalLogMgr abstract class
class LegalLogMgr {
public:
static void parseExtraParameters(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
/// @brief Opens the store.
- virtual void open() = 0;
+ ///
+ /// @param id the forensic backend manager ID.
+ virtual void open(ManagerID id = 0) = 0;
/// @brief Closes the store.
virtual void close() = 0;
isc::db::DatabaseConnection::ParameterMap parameters_;
};
-/// @brief Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
-typedef uint64_t ManagerID;
-
/// @brief LegalLogMgr pool
typedef std::map<ManagerID, std::pair<isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr>> LegalLogMgrPool;
" factory returned NULL");
}
- backend->open();
+ // Add the parameters and an empty instance in case retry on startup is configured.
+ pool_[id] = pair<DatabaseConnection::ParameterMap, LegalLogMgrPtr>(parameters, LegalLogMgrPtr());
+
+ backend->open(id);
// Apply extra parameters.
if (parameters.find("request-parser-format") != parameters.end()) {
}
/// @brief Opens the store.
- virtual void open() {
+ virtual void open(ManagerID) {
}
/// @brief Closes the store.