Commit 5215b1fe authored by Steven Murray's avatar Steven Murray
Browse files

TapeDaemonConfig now contains ProcessForkerConfig which contains DataTransferConfig

parent a1daca81
......@@ -25,8 +25,8 @@ add_library(castorTapeServerDaemon
MigrationTaskInjector.cpp
DataTransferSession.cpp
ProcessForker.cpp
ProcessForkerConfig.cpp
ProcessForkerConnectionHandler.cpp
ProcessForkerOneTimeConfig.cpp
ProcessForkerProxy.cpp
ProcessForkerProxyDummy.cpp
ProcessForkerProxySocket.cpp
......
......@@ -34,11 +34,7 @@ namespace tapeserver {
namespace daemon {
/**
* The contents of the castor.conf file to be used by the
* DataTransferSession.
*
* The pre-extraction of the contents by the caller instead of direct
* getconfent() calls facilitates unit-testing.
* The contents of the castor.conf file to be used by a DataTransferSession.
*/
struct DataTransferConfig {
......
......@@ -66,7 +66,7 @@ castor::tape::tapeserver::daemon::ProcessForker::ProcessForker(
const int reaperSocket,
const std::string &hostName,
char *const argv0,
const ProcessForkerOneTimeConfig &config) throw():
const ProcessForkerConfig &config) throw():
m_log(log),
m_cmdSocket(cmdSocket),
m_reaperSocket(reaperSocket),
......
......@@ -29,8 +29,8 @@
#include "castor/messages/ForkDataTransfer.pb.h"
#include "castor/messages/ForkLabel.pb.h"
#include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerConfig.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerFrame.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerOneTimeConfig.hpp"
#include <stdint.h>
......@@ -65,7 +65,7 @@ public:
*/
ProcessForker(log::Logger &log, const int cmdSocket, const int reaperSocket,
const std::string &hostName, char *const argv0,
const ProcessForkerOneTimeConfig &config) throw();
const ProcessForkerConfig &config) throw();
/**
* Destructor.
......@@ -116,10 +116,9 @@ private:
char *const m_argv0;
/**
* The CASTOR configuration parameters used by the ProcessForker for the
* entire lifetime of the process.
* The CASTOR configuration parameters used by the ProcessForker.
*/
const ProcessForkerOneTimeConfig m_config;
const ProcessForkerConfig m_config;
/**
* Idempotent method that closes the socket used for receving commands
......
......@@ -22,26 +22,26 @@
*****************************************************************************/
#include "castor/common/CastorConfiguration.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerOneTimeConfig.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerConfig.hpp"
#include "h/rmc_constants.h"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::ProcessForkerOneTimeConfig::
ProcessForkerOneTimeConfig():
castor::tape::tapeserver::daemon::ProcessForkerConfig::
ProcessForkerConfig():
rmcPort(0) {
}
//------------------------------------------------------------------------------
// createFromCastorConfig
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::ProcessForkerOneTimeConfig
castor::tape::tapeserver::daemon::ProcessForkerOneTimeConfig::
castor::tape::tapeserver::daemon::ProcessForkerConfig
castor::tape::tapeserver::daemon::ProcessForkerConfig::
createFromCastorConf(log::Logger *const log) {
common::CastorConfiguration &castorConf =
common::CastorConfiguration::getConfig();
ProcessForkerOneTimeConfig config;
ProcessForkerConfig config;
config.rmcPort = castorConf.getConfEntInt("RMC", "PORT",
(unsigned short)RMC_PORT, log);
......
......@@ -32,9 +32,9 @@ namespace daemon {
/**
* Structure containing the CASTOR configuration parameters used by the
* ProcessForker for the entire lifetime of the process.
* ProcessForker.
*/
struct ProcessForkerOneTimeConfig {
struct ProcessForkerConfig {
/**
* The TCP/IP port on which the rmcd daemon is listening.
......@@ -50,7 +50,7 @@ struct ProcessForkerOneTimeConfig {
* Constructor that sets all integer member-variables to 0 and all string
* member-variables to the emptry string.
*/
ProcessForkerOneTimeConfig();
ProcessForkerConfig();
/**
* Returns a configuration structure based on the contents of
......@@ -59,10 +59,10 @@ struct ProcessForkerOneTimeConfig {
* @param log pointer to NULL or an optional logger object.
* @return The configuration structure.
*/
static ProcessForkerOneTimeConfig createFromCastorConf(
static ProcessForkerConfig createFromCastorConf(
log::Logger *const log = NULL);
}; // class ProcessForkerOneTimeConfig
}; // class ProcessForkerConfig
} // namespace daemon
} // namespace tapeserver
......
......@@ -60,7 +60,7 @@ TEST_F(castor_tape_tapeserver_daemon_ProcessForkerTest, constructor) {
const std::string hostName = "hostName";
castor::log::DummyLogger log(programName);
char argv0[12] = "tapeserverd";
ProcessForkerOneTimeConfig processForkerConfig;
ProcessForkerConfig processForkerConfig;
std::auto_ptr<ProcessForker> processForker;
ASSERT_NO_THROW(processForker.reset(
new ProcessForker(log, cmdReceiverSocket.get(), reaperSenderSocket.get(),
......@@ -85,7 +85,7 @@ TEST_F(castor_tape_tapeserver_daemon_ProcessForkerTest, socketproxy) {
const std::string hostName = "hostName";
castor::log::DummyLogger log(programName);
char argv0[12] = "tapeserverd";
ProcessForkerOneTimeConfig processForkerConfig;
ProcessForkerConfig processForkerConfig;
std::auto_ptr<ProcessForker> processForker;
ASSERT_NO_THROW(processForker.reset(
new ProcessForker(log, cmdReceiverSocket.get(), reaperSenderSocket.get(),
......
......@@ -208,8 +208,8 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
m_processForkerPid = forkProcessForker(cmdPair, reaperPair);
const ProcessForkerOneTimeConfig processForkerConfig =
ProcessForkerOneTimeConfig::createFromCastorConf(&m_log);
const ProcessForkerConfig processForkerConfig =
ProcessForkerConfig::createFromCastorConf(&m_log);
m_processForker = new ProcessForkerProxySocket(m_log, cmdPair.tapeDaemon);
m_catalogue = new Catalogue(
m_netTimeout,
......@@ -542,8 +542,8 @@ void castor::tape::tapeserver::daemon::TapeDaemon::
int castor::tape::tapeserver::daemon::TapeDaemon::runProcessForker(
const int cmdReceiverSocket, const int reaperSenderSocket) throw() {
try {
const ProcessForkerOneTimeConfig processForkerConfig =
ProcessForkerOneTimeConfig::createFromCastorConf();
const ProcessForkerConfig processForkerConfig =
ProcessForkerConfig::createFromCastorConf();
ProcessForker processForker(m_log, cmdReceiverSocket, reaperSenderSocket,
m_hostName, m_argv[0], processForkerConfig);
processForker.execute();
......
......@@ -46,7 +46,7 @@ castor::tape::tapeserver::daemon::TapeDaemonConfig
TapeDaemonConfig config;
config.dataTransferConfig = DataTransferConfig::createFromCastorConf(log);
config.processForkerConfig = ProcessForkerConfig::createFromCastorConf(log);
config.waitJobTimeoutInSecs = castorConf.getConfEntInt("TAPESERVERD",
"WAITJOBTIMEOUT", (time_t)TAPESERVER_WAITJOBTIMEOUT_DEFAULT, log);
......
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/log/Logger.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferConfig.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerConfig.hpp"
#include <stdint.h>
#include <string>
......@@ -36,20 +36,13 @@ namespace daemon {
/**
* The contents of the castor.conf file to be used by the tape-server daemon.
*
* The pre-extraction of the contents by the caller instead of direct
* getconfent() calls facilitates unit-testing.
*/
struct TapeDaemonConfig {
/**
* The contents of the castor.conf file to be used by the
* DataTransferSession.
*
* The pre-extraction of the contents by the caller instead of direct
* getconfent() calls facilitates unit-testing.
* The CASTOR configuration parameters used by the ProcessForker.
*/
DataTransferConfig dataTransferConfig;
ProcessForkerConfig processForkerConfig;
/**
* The maximum time in seconds that the data-transfer session can take to get
......
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