XRootD
Loading...
Searching...
No Matches
XrdSsiCms Class Reference

#include <XrdSsiCms.hh>

Inheritance diagram for XrdSsiCms:
Collaboration diagram for XrdSsiCms:

Public Member Functions

 XrdSsiCms ()
 XrdSsiCms (XrdCmsClient *cmsP)
virtual ~XrdSsiCms ()
void Added (const char *name, bool pend=false)
bool DataContext ()
const char *const * Managers (int &mNum)
int Release (int n=1)
void Removed (const char *name)
int Reserve (int n=1)
int Resource (int n)
void Resume (bool perm=true)
void Suspend (bool perm=true)
void Utilization (unsigned int util, bool alert=false)
Public Member Functions inherited from XrdSsiCluster
 XrdSsiCluster ()
 Destructor.
virtual ~XrdSsiCluster ()

Detailed Description

Definition at line 37 of file XrdSsiCms.hh.

Constructor & Destructor Documentation

◆ XrdSsiCms() [1/2]

XrdSsiCms::XrdSsiCms ( )
inline

Definition at line 74 of file XrdSsiCms.hh.

74: theCms(0), manList(0), manNum(0) {}

◆ XrdSsiCms() [2/2]

XrdSsiCms::XrdSsiCms ( XrdCmsClient * cmsP)

Definition at line 52 of file XrdSsiCms.cc.

52 : theCms(cmsP)
53{
54 XrdOucTList *tP, *stP = cmsP->Managers();
55 char buff[1024];
56 int i;
57
58// Count up the number of entries in the manager list
59//
60 manNum = 0;
61 tP = stP;
62 while(tP) {manNum++; tP = tP->next;}
63
64// Allocate an array of the right size
65//
66 manList = new char*[manNum];
67
68// Format out the managers
69//
70 for (i = 0; i < manNum; i++)
71 {sprintf(buff, "%s:%d", stP->text, stP->val);
72 manList[i] = strdup(buff);
73 stP = stP->next;
74 }
75}
virtual XrdOucTList * Managers()
XrdOucTList * next

References XrdCmsClient::Managers(), XrdOucTList::next, and XrdOucTList::text.

Here is the call graph for this function:

◆ ~XrdSsiCms()

XrdSsiCms::~XrdSsiCms ( )
virtual

Definition at line 111 of file XrdSsiCms.cc.

112{
113 int i;
114
115 for (i = 0; i < manNum; i++) free(manList[i]);
116
117 delete[] manList;
118}

Member Function Documentation

◆ Added()

void XrdSsiCms::Added ( const char * name,
bool pend = false )
virtual

Notify the cluster of a newly added endpoint name or whose state has changed on on this server node.

Parameters
nameThe logical name.
pendWhen true, the name is scheduled to be present in the future.

Implements XrdSsiCluster.

Definition at line 81 of file XrdSsiCms.cc.

82{
83// Do statistics
84//
86
87// Perform action
88//
89 if (theCms) theCms->Added(name, pend);
90}
void Bump(int &val)
XrdSsiStats Stats

References XrdSsi::Stats.

◆ DataContext()

bool XrdSsiCms::DataContext ( )
inlinevirtual

Determine whether or not the SSI plug-in is running in a data context.

Returns
true running in a data context (i.e. xrootd).
false running is a meta context (i.e. cmsd).

Implements XrdSsiCluster.

Definition at line 43 of file XrdSsiCms.hh.

43{return true;}

◆ Managers()

const char *const * XrdSsiCms::Managers ( int & mNum)
inlinevirtual

Obtain the list of nodes that are managing this cluster.

Parameters
mNumPlace to put the number of managers in the returned array.
Returns
The vector of nodes being used with mNum set to the number of elements. The list is considered permanent and is not deleted.

Implements XrdSsiCluster.

Definition at line 46 of file XrdSsiCms.hh.

46{mNum = manNum; return manList;}

◆ Release()

int XrdSsiCms::Release ( int n = 1)
inlinevirtual

Increase the amount of resource available. When transitioning from a a non-positive to a positive resource amount, perform a resume so that additional clients may be dispatched to this server.

Parameters
nThe value to add to the resources available (default 1). The total amount is capped by the amount specified by Resource().
Returns
The amount of resource left.

Implements XrdSsiCluster.

Definition at line 66 of file XrdSsiCms.hh.

67 {if (theCms) return theCms->Release(n);
68 return 0;
69 }

◆ Removed()

void XrdSsiCms::Removed ( const char * name)
virtual

Notify the cluster that a name is no longer available on this server node.

Parameters
nameThe logical name that is no longer available.

Implements XrdSsiCluster.

Definition at line 96 of file XrdSsiCms.cc.

97{
98// Do statistics
99//
101
102// Perform action
103//
104 if (theCms) theCms->Removed(name);
105}

References XrdSsi::Stats.

◆ Reserve()

int XrdSsiCms::Reserve ( int n = 1)
inlinevirtual

Decrease the amount of resources available. When the available resources becomes non-positive, perform a temporary suspend to prevent additional clients from being dispatched to this server.

Parameters
nThe value by which resources are decreased (default 1).
Returns
The amount of resource left.

Implements XrdSsiCluster.

Definition at line 61 of file XrdSsiCms.hh.

62 {if (theCms) return theCms->Reserve(n);
63 return 0;
64 }

◆ Resource()

int XrdSsiCms::Resource ( int n)
inlinevirtual

Enable the Reserve() & Release() methods.

Parameters
na positive integer that specifies the amount of resource units that are available. It may be reset at any time.
Returns
The previous resource value. This first call returns 0.

Implements XrdSsiCluster.

Definition at line 56 of file XrdSsiCms.hh.

57 {if (theCms) return theCms->Resource(n);
58 return 0;
59 }

◆ Resume()

void XrdSsiCms::Resume ( bool perm = true)
inlinevirtual

Resume service after a suspension.

Parameters
permWhen true the resume persist across server restarts. Otherwise, it is treated as a temporary request.

Implements XrdSsiCluster.

Definition at line 50 of file XrdSsiCms.hh.

51 {if (theCms) theCms->Resume(perm);}

◆ Suspend()

void XrdSsiCms::Suspend ( bool perm = true)
inlinevirtual

Suspend service.

Parameters
permWhen true the suspend persist across server restarts. Otherwise, it is treated as a temporary request.

Implements XrdSsiCluster.

Definition at line 53 of file XrdSsiCms.hh.

54 {if (theCms) theCms->Suspend(perm);}

◆ Utilization()

void XrdSsiCms::Utilization ( unsigned int util,
bool alert = false )
inlinevirtual

Report utilization of this server. This may be used in lieu of general performance metric reporting. For consistent results use only one method.

Parameters
utilA value from 0 to 100 representing utilization. Values greater than 100 are set to be 100.
alertWhen true the utilization is forcibly report to the cluster managers. Otherwise, reporting is done only when it will significantly change server selection.

Implements XrdSsiCluster.

Definition at line 71 of file XrdSsiCms.hh.

72 {if (theCms) return theCms->Utilization(util, alert);}

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