DataTransferConfig.cpp 4.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/******************************************************************************
 *
 * This file is part of the Castor project.
 * See http://castor.web.cern.ch/castor
 *
 * Copyright (C) 2003  CERN
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * 
 *
 * @author Castor Dev team, castor-dev@cern.ch
 *****************************************************************************/

#include "castor/common/CastorConfiguration.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferConfig.hpp"
26
#include "castor/tape/tapeserver/daemon/Constants.hpp"
27
#include "castor/tape/tapeserver/TapeBridgeConstants.hpp"
28
29
30
31

//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
Steven Murray's avatar
Steven Murray committed
32
33
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig()
  throw():
34
35
36
37
38
39
40
41
  bufsz(0),
  nbBufs(0),
  bulkRequestMigrationMaxBytes(0),
  bulkRequestMigrationMaxFiles(0),
  bulkRequestRecallMaxBytes(0),
  bulkRequestRecallMaxFiles(0),
  maxBytesBeforeFlush(0),
  maxFilesBeforeFlush(0),
42
43
  nbDiskThreads(0),
  useLbp(false) {
44
45
46
47
48
}

//------------------------------------------------------------------------------
// createFromCastorConf
//------------------------------------------------------------------------------
Steven Murray's avatar
Steven Murray committed
49
castor::tape::tapeserver::daemon::DataTransferConfig
50
  castor::tape::tapeserver::daemon::DataTransferConfig::createFromCastorConf(
Victor Kotlyar's avatar
Victor Kotlyar committed
51
    cta::log::Logger *const log) {
52
53
54
55
56
  common::CastorConfiguration &castorConf =
    common::CastorConfiguration::getConfig();
  DataTransferConfig config;

  config.bufsz = castorConf.getConfEntInt(
57
    "TapeServer", "BufSize",
58
    castor::tape::tapeserver::daemon::TAPESERVER_BUFSZ, log);
59
  config.nbBufs = castorConf.getConfEntInt<uint32_t>(
60
    "TapeServer", "NbBufs", log);
61
  config.bulkRequestMigrationMaxBytes = castorConf.getConfEntInt(
62
    "TapeServer", "BulkRequestMigrationMaxBytes",
63
64
    (uint64_t)TAPEBRIDGE_BULKREQUESTMIGRATIONMAXBYTES, log);
  config.bulkRequestMigrationMaxFiles = castorConf.getConfEntInt(
65
    "TapeServer", "BulkRequestMigrationMaxFiles",
66
67
    (uint64_t)TAPEBRIDGE_BULKREQUESTMIGRATIONMAXFILES, log);
  config.bulkRequestRecallMaxBytes = castorConf.getConfEntInt(
68
    "TapeServer", "BulkRequestRecallMaxBytes",
69
70
    (uint64_t)TAPEBRIDGE_BULKREQUESTRECALLMAXBYTES, log);
  config.bulkRequestRecallMaxFiles = castorConf.getConfEntInt(
71
    "TapeServer", "BulkRequestRecallMaxFiles",
72
73
    (uint64_t)TAPEBRIDGE_BULKREQUESTRECALLMAXFILES, log);
  config.maxBytesBeforeFlush = castorConf.getConfEntInt(
74
    "TapeServer", "MaxBytesBeforeFlush",
75
76
    (uint64_t)TAPEBRIDGE_MAXBYTESBEFOREFLUSH, log);
  config.maxFilesBeforeFlush = castorConf.getConfEntInt(
77
    "TapeServer", "MaxFilesBeforeFlush",
78
79
    (uint64_t)TAPEBRIDGE_MAXFILESBEFOREFLUSH, log);
  config.nbDiskThreads = castorConf.getConfEntInt(
80
    "TapeServer", "NbDiskThreads", 
81
    castor::tape::tapeserver::daemon::TAPESERVER_NB_DISK_THREAD, log);
82
  config.remoteFileProtocol = castorConf.getConfEntString(
83
    "TapeServer", "RemoteFileProtocol", "RFIO", log);
84
  config.xrootPrivateKey = castorConf.getConfEntString(
85
    "TapeServer", "XrootPrivateKey", "/etc/castor/xrd_tape_key.pem", log);
86
87
88
89
90
91
92
93
  const std::string useLBP = castorConf.getConfEntString(
    "TapeServer", "UseLogicalBlockProtection", "no", log);

  if (!strcasecmp(useLBP.c_str(), "yes") || !strcmp(useLBP.c_str(), "1")) {
    config.useLbp = true;
  } else {
    config.useLbp = false;
  }
94
95
96

  return config;
}