DataTransferConfig.cpp 3.9 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
26
/******************************************************************************
 *
 * 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/Constants.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferConfig.hpp"
27
#include "castor/tape/tapeserver/daemon/Constants.hpp"
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig():
  bufsz(0),
  nbBufs(0),
  bulkRequestMigrationMaxBytes(0),
  bulkRequestMigrationMaxFiles(0),
  bulkRequestRecallMaxBytes(0),
  bulkRequestRecallMaxFiles(0),
  maxBytesBeforeFlush(0),
  maxFilesBeforeFlush(0),
  nbDiskThreads(0) {
}

//------------------------------------------------------------------------------
// createFromCastorConf
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig
  castor::tape::tapeserver::daemon::DataTransferConfig::createFromCastorConf(
    log::Logger *const log) {
  common::CastorConfiguration &castorConf =
    common::CastorConfiguration::getConfig();
  DataTransferConfig config;

  config.bufsz = castorConf.getConfEntInt(
55
56
    "TAPESERVERD", "BUFSZ",
    castor::tape::tapeserver::daemon::TAPESERVER_BUFSZ_DEFAULT, log);
57
  config.nbBufs = castorConf.getConfEntInt<uint32_t>(
58
    "TAPESERVERD", "NB_BUFS", log);
59
  config.tapeBadMIRHandlingRepair = castorConf.getConfEntString(
60
    "TAPESERVERD", "BADMIR_HANDLING", "CANCEL", log);
61
  config.bulkRequestMigrationMaxBytes = castorConf.getConfEntInt(
62
    "TAPESERVERD", "BULKREQUESTMIGRATIONMAXBYTES",
63
64
    (uint64_t)TAPEBRIDGE_BULKREQUESTMIGRATIONMAXBYTES, log);
  config.bulkRequestMigrationMaxFiles = castorConf.getConfEntInt(
65
    "TAPESERVERD", "BULKREQUESTMIGRATIONMAXFILES",
66
67
    (uint64_t)TAPEBRIDGE_BULKREQUESTMIGRATIONMAXFILES, log);
  config.bulkRequestRecallMaxBytes = castorConf.getConfEntInt(
68
    "TAPESERVERD", "BULKREQUESTRECALLMAXBYTES",
69
70
    (uint64_t)TAPEBRIDGE_BULKREQUESTRECALLMAXBYTES, log);
  config.bulkRequestRecallMaxFiles = castorConf.getConfEntInt(
71
    "TAPESERVERD", "BULKREQUESTRECALLMAXFILES",
72
73
    (uint64_t)TAPEBRIDGE_BULKREQUESTRECALLMAXFILES, log);
  config.maxBytesBeforeFlush = castorConf.getConfEntInt(
74
    "TAPESERVERD", "MAXBYTESBEFOREFLUSH",
75
76
    (uint64_t)TAPEBRIDGE_MAXBYTESBEFOREFLUSH, log);
  config.maxFilesBeforeFlush = castorConf.getConfEntInt(
77
    "TAPESERVERD", "MAXFILESBEFOREFLUSH",
78
79
    (uint64_t)TAPEBRIDGE_MAXFILESBEFOREFLUSH, log);
  config.nbDiskThreads = castorConf.getConfEntInt(
80
81
    "TAPESERVERD", "THREAD_POOL", 
    castor::tape::tapeserver::daemon::TAPESERVER_NB_DISK_THREAD_DEFAULT, log);
82
83
84
  config.remoteFileProtocol = castorConf.getConfEntString(
    "TAPESERVERD", "REMOTEFILEPROTOCOL", "RFIO", log);
  config.xrootPrivateKey = castorConf.getConfEntString(
85
    "XROOT", "PrivateKey", "/opt/xrootd/keys/key.pem", log);
86
87
88

  return config;
}