XRootD
XrdThrottle::Configuration Class Reference

#include <XrdThrottleConfig.hh>

+ Collaboration diagram for XrdThrottle::Configuration:

Public Member Functions

 Configuration (XrdSysError &log, XrdOucEnv *env)
 
int Configure (const std::string &config_file)
 
const std::string & GetFileSystemLibrary () const
 
long long GetLoadshedFreq () const
 
const std::string & GetLoadshedHost () const
 
long long GetLoadshedPort () const
 
long long GetMaxConn () const
 
long long GetMaxOpen () const
 
long long GetMaxWait () const
 
long long GetThrottleConcurrency () const
 
long long GetThrottleDataRate () const
 
long long GetThrottleIOPSRate () const
 
long long GetThrottleRecomputeIntervalMS () const
 
int GetTraceLevels () const
 

Detailed Description

Definition at line 13 of file XrdThrottleConfig.hh.

Constructor & Destructor Documentation

◆ Configuration()

XrdThrottle::Configuration::Configuration ( XrdSysError log,
XrdOucEnv env 
)
inline

Definition at line 15 of file XrdThrottleConfig.hh.

16  : m_env(env), m_log(log)
17  {}

Member Function Documentation

◆ Configure()

int Configuration::Configure ( const std::string &  config_file)

Definition at line 17 of file XrdThrottleConfig.cc.

18 {
19  XrdOucEnv myEnv;
20  XrdOucStream Config(&m_log, getenv("XRDINSTANCE"), &myEnv, "(Throttle Config)> ");
21  int cfgFD;
22  if (config_file.empty()) {
23  m_log.Say("No filename specified.");
24  return 1;
25  }
26  if ((cfgFD = open(config_file.c_str(), O_RDONLY)) < 0) {
27  m_log.Emsg("Config", errno, "Unable to open configuration file", config_file.c_str());
28  return 1;
29  }
30  Config.Attach(cfgFD);
31  static const char *cvec[] = { "*** throttle (ofs) plugin config:", 0 };
32  Config.Capture(cvec);
33 
34  char *var, *val;
35  int NoGo = 0;
36  while( (var = Config.GetMyFirstWord()) )
37  {
38  if (!strcmp("throttle.fslib", var)) {
39  val = Config.GetWord();
40  if (!val || !val[0]) {m_log.Emsg("Config", "fslib not specified."); continue;}
41  m_fslib = val;
42  }
43  TS_Xeq("throttle.max_open_files", xmaxopen);
44  TS_Xeq("throttle.max_active_connections", xmaxconn);
45  TS_Xeq("throttle.throttle", xthrottle);
46  TS_Xeq("throttle.loadshed", xloadshed);
47  TS_Xeq("throttle.max_wait_time", xmaxwait);
48  TS_Xeq("throttle.trace", xtrace);
49  if (NoGo)
50  {
51  m_log.Emsg("Config", "Throttle configuration failed.");
52  return 1;
53  }
54  }
55  return 0;
56 }
#define open
Definition: XrdPosix.hh:76
#define TS_Xeq(key, func)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition: XrdSysError.cc:141
XrdCmsConfig Config

References XrdCms::Config, XrdSysError::Emsg(), open, XrdSysError::Say(), and TS_Xeq.

+ Here is the call graph for this function:

◆ GetFileSystemLibrary()

const std::string& XrdThrottle::Configuration::GetFileSystemLibrary ( ) const
inline

Definition at line 26 of file XrdThrottleConfig.hh.

26 { return m_fslib; }

◆ GetLoadshedFreq()

long long XrdThrottle::Configuration::GetLoadshedFreq ( ) const
inline

Definition at line 40 of file XrdThrottleConfig.hh.

40 { return m_loadshed_freq; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetLoadshedHost()

const std::string& XrdThrottle::Configuration::GetLoadshedHost ( ) const
inline

Definition at line 30 of file XrdThrottleConfig.hh.

30 { return m_loadshed_hostname; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetLoadshedPort()

long long XrdThrottle::Configuration::GetLoadshedPort ( ) const
inline

Definition at line 35 of file XrdThrottleConfig.hh.

35 { return m_loadshed_port; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetMaxConn()

long long XrdThrottle::Configuration::GetMaxConn ( ) const
inline

Definition at line 48 of file XrdThrottleConfig.hh.

48 { return m_max_conn; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetMaxOpen()

long long XrdThrottle::Configuration::GetMaxOpen ( ) const
inline

Definition at line 44 of file XrdThrottleConfig.hh.

44 { return m_max_open; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetMaxWait()

long long XrdThrottle::Configuration::GetMaxWait ( ) const
inline

Definition at line 53 of file XrdThrottleConfig.hh.

53 { return m_max_wait; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetThrottleConcurrency()

long long XrdThrottle::Configuration::GetThrottleConcurrency ( ) const
inline

Definition at line 57 of file XrdThrottleConfig.hh.

57 { return m_throttle_concurrency_limit; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetThrottleDataRate()

long long XrdThrottle::Configuration::GetThrottleDataRate ( ) const
inline

Definition at line 61 of file XrdThrottleConfig.hh.

61 { return m_throttle_data_rate; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetThrottleIOPSRate()

long long XrdThrottle::Configuration::GetThrottleIOPSRate ( ) const
inline

Definition at line 65 of file XrdThrottleConfig.hh.

65 { return m_throttle_iops_rate; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetThrottleRecomputeIntervalMS()

long long XrdThrottle::Configuration::GetThrottleRecomputeIntervalMS ( ) const
inline

Definition at line 69 of file XrdThrottleConfig.hh.

69 { return m_throttle_recompute_interval_ms; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

◆ GetTraceLevels()

int XrdThrottle::Configuration::GetTraceLevels ( ) const
inline

Definition at line 73 of file XrdThrottleConfig.hh.

73 { return m_trace_levels; }

Referenced by XrdThrottleManager::FromConfig().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: