XRootD
Loading...
Searching...
No Matches
XrdSsiCms.cc
Go to the documentation of this file.
1
/******************************************************************************/
2
/* */
3
/* X r d S s i C m s . c c */
4
/* */
5
/* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */
6
/* All Rights Reserved */
7
/* Produced by Andrew Hanushevsky for Stanford University under contract */
8
/* DE-AC02-76-SFO0515 with the Department of Energy */
9
/* */
10
/* This file is part of the XRootD software suite. */
11
/* */
12
/* XRootD is free software: you can redistribute it and/or modify it under */
13
/* the terms of the GNU Lesser General Public License as published by the */
14
/* Free Software Foundation, either version 3 of the License, or (at your */
15
/* option) any later version. */
16
/* */
17
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20
/* License for more details. */
21
/* */
22
/* You should have received a copy of the GNU Lesser General Public License */
23
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25
/* */
26
/* The copyright holder's institutional names and contributor's names may not */
27
/* be used to endorse or promote products derived from this software without */
28
/* specific prior written permission of the institution or contributor. */
29
/******************************************************************************/
30
31
#include <cstdio>
32
33
#include "
XrdOuc/XrdOucTList.hh
"
34
35
#include "
XrdSsi/XrdSsiCms.hh
"
36
#include "
XrdSsi/XrdSsiStats.hh
"
37
38
/******************************************************************************/
39
/* G l o b a l s */
40
/******************************************************************************/
41
42
namespace
XrdSsi
43
{
44
extern
XrdSsiStats
Stats
;
45
}
46
using namespace
XrdSsi
;
47
48
/******************************************************************************/
49
/* C o n s t r u c t o r */
50
/******************************************************************************/
51
52
XrdSsiCms::XrdSsiCms
(
XrdCmsClient
*cmsP) : 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
}
76
77
/******************************************************************************/
78
/* A d d e d */
79
/******************************************************************************/
80
81
void
XrdSsiCms::Added
(
const
char
*name,
bool
pend)
82
{
83
// Do statistics
84
//
85
Stats
.
Bump
(
Stats
.
ResAdds
);
86
87
// Perform action
88
//
89
if
(theCms) theCms->
Added
(name, pend);
90
}
91
92
/******************************************************************************/
93
/* R e m o v e d */
94
/******************************************************************************/
95
96
void
XrdSsiCms::Removed
(
const
char
*name)
97
{
98
// Do statistics
99
//
100
Stats
.
Bump
(
Stats
.
ResRems
);
101
102
// Perform action
103
//
104
if
(theCms) theCms->
Removed
(name);
105
}
106
107
/******************************************************************************/
108
/* D e s t r u c t o r */
109
/******************************************************************************/
110
111
XrdSsiCms::~XrdSsiCms
()
112
{
113
int
i;
114
115
for
(i = 0; i < manNum; i++) free(manList[i]);
116
117
delete
[] manList;
118
}
XrdOucTList.hh
XrdSsiCms.hh
XrdSsiStats.hh
XrdCmsClient
Definition
XrdCmsClient.hh:116
XrdCmsClient::Added
virtual void Added(const char *path, int Pend=0)
Definition
XrdCmsClient.hh:128
XrdCmsClient::Removed
virtual void Removed(const char *path)
Definition
XrdCmsClient.hh:258
XrdCmsClient::Managers
virtual XrdOucTList * Managers()
Definition
XrdCmsClient.hh:232
XrdOucStats::Bump
void Bump(int &val)
Definition
XrdOucStats.hh:47
XrdOucTList
Definition
XrdOucTList.hh:42
XrdOucTList::next
XrdOucTList * next
Definition
XrdOucTList.hh:45
XrdOucTList::text
char * text
Definition
XrdOucTList.hh:46
XrdSsiCms::Removed
void Removed(const char *name)
Definition
XrdSsiCms.cc:96
XrdSsiCms::XrdSsiCms
XrdSsiCms()
Definition
XrdSsiCms.hh:74
XrdSsiCms::Added
void Added(const char *name, bool pend=false)
Definition
XrdSsiCms.cc:81
XrdSsiCms::~XrdSsiCms
virtual ~XrdSsiCms()
Definition
XrdSsiCms.cc:111
XrdSsiStats
Definition
XrdSsiStats.hh:38
XrdSsiStats::ResAdds
int ResAdds
Definition
XrdSsiStats.hh:65
XrdSsiStats::ResRems
int ResRems
Definition
XrdSsiStats.hh:66
XrdSsi
Definition
XrdSsiClient.cc:65
XrdSsi::Stats
XrdSsiStats Stats
Definition
XrdSsiFileReq.cc:69
XrdSsi
XrdSsiCms.cc
Generated by
1.12.0