xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdClient
XrdClientAdmin.hh
Go to the documentation of this file.
1
#ifndef XRD_CLIENT_ADMIN_H
2
#define XRD_CLIENT_ADMIN_H
3
/******************************************************************************/
4
/* */
5
/* X r d C l i e n t A d m i n . h h */
6
/* */
7
/* Author: Fabrizio Furano (INFN Padova, 2004) */
8
/* Adapted from TXNetFile (root.cern.ch) originally done by */
9
/* Alvise Dorigo, Fabrizio Furano */
10
/* INFN Padova, 2003 */
11
/* */
12
/* This file is part of the XRootD software suite. */
13
/* */
14
/* XRootD is free software: you can redistribute it and/or modify it under */
15
/* the terms of the GNU Lesser General Public License as published by the */
16
/* Free Software Foundation, either version 3 of the License, or (at your */
17
/* option) any later version. */
18
/* */
19
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22
/* License for more details. */
23
/* */
24
/* You should have received a copy of the GNU Lesser General Public License */
25
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27
/* */
28
/* The copyright holder's institutional names and contributor's names may not */
29
/* be used to endorse or promote products derived from this software without */
30
/* specific prior written permission of the institution or contributor. */
31
/******************************************************************************/
32
34
// //
35
// A UNIX reference admin client for xrootd. //
36
// //
38
39
#include "
XrdClient/XrdClientAbs.hh
"
40
#include "
XrdClient/XrdClientVector.hh
"
41
#include "
XrdOuc/XrdOucHash.hh
"
42
#include "
XrdOuc/XrdOucString.hh
"
43
44
typedef
XrdClientVector<XrdOucString>
vecString
;
45
typedef
XrdClientVector<bool>
vecBool
;
46
47
void
joinStrings
(
XrdOucString
&buf,
vecString
&vs,
int
startidx = 0,
int
endidx=-1);
48
49
struct
XrdClientLocate_Info
{
50
enum
{
51
kXrdcLocNone
,
52
kXrdcLocDataServer
,
53
kXrdcLocDataServerPending
,
54
kXrdcLocManager
,
55
kXrdcLocManagerPending
56
}
Infotype
;
57
58
bool
CanWrite
;
59
60
kXR_char
Location
[256];
61
};
62
63
class
XrdClientAdmin
:
public
XrdClientAbs
{
64
65
XrdOucString
fInitialUrl
;
66
bool
DirList_low
(
const
char
*dir,
vecString
&entries);
67
int
LocalLocate
(
kXR_char
*path,
68
XrdClientVector<XrdClientLocate_Info>
&res,
69
bool
writable,
int
opts,
bool
all =
false
);
70
protected
:
71
72
bool
CanRedirOnError
() {
73
// We deny any redir on error
74
return
false
;
75
}
76
77
// To be called after a redirection
78
bool
OpenFileWhenRedirected
(
char
*,
bool
&);
79
80
public
:
81
XrdClientAdmin
(
const
char
*url);
82
virtual
~XrdClientAdmin
();
83
84
bool
Connect
();
85
86
// Some administration functions, see the protocol specs for details
87
bool
SysStatX
(
const
char
*paths_list,
88
kXR_char
*binInfo);
89
90
bool
Stat
(
const
char
*fname,
91
long
&
id
,
92
long
long
&size,
93
long
&flags,
94
long
&modtime);
95
96
97
bool
Stat_vfs
(
const
char
*fname,
98
int
&rwservers,
99
long
long
&rwfree,
100
int
&rwutil,
101
int
&stagingservers,
102
long
long
&stagingfree,
103
int
&stagingutil);
104
105
bool
DirList
(
const
char
*dir,
106
vecString
&entries,
bool
askallservers=
false
);
107
108
struct
DirListInfo
{
109
XrdOucString
fullpath
;
110
XrdOucString
host
;
111
long
long
size
;
112
long
id
;
113
long
flags
;
114
long
modtime
;
115
};
116
bool
DirList
(
const
char
*dir,
117
XrdClientVector<DirListInfo>
&dirlistinfo,
118
bool
askallservers=
false
);
119
120
bool
ExistFiles
(
vecString
&,
121
vecBool
&);
122
123
bool
ExistDirs
(
vecString
&,
124
vecBool
&);
125
126
// Compute an estimation of the available free space in the given cachefs partition
127
// The estimation can be fooled if multiple servers mount the same network storage
128
bool
GetSpaceInfo
(
const
char
*logicalname,
129
long
long
&totspace,
130
long
long
&totfree,
131
long
long
&totused,
132
long
long
&largestchunk);
133
134
long
GetChecksum
(
kXR_char
*path,
135
kXR_char
**chksum);
136
137
// Quickly jump to the former redirector. Useful after having been redirected.
138
void
GoBackToRedirector
();
139
140
bool
IsFileOnline
(
vecString
&,
141
vecBool
&);
142
143
bool
Mv
(
const
char
*fileSrc,
144
const
char
*fileDest);
145
146
bool
Mkdir
(
const
char
*dir,
147
int
user,
148
int
group,
149
int
other);
150
151
bool
Chmod
(
const
char
*file,
152
int
user,
153
int
group,
154
int
other);
155
156
bool
Rm
(
const
char
*file);
157
158
bool
Rmdir
(
const
char
*path);
159
160
bool
Protocol
(
kXR_int32
&proto,
161
kXR_int32
&kind);
162
163
bool
Prepare
(
vecString
vs,
164
kXR_char
opts,
165
kXR_char
prty);
166
bool
Prepare
(
const
char
*paths,
167
kXR_char
opts,
168
kXR_char
prty);
169
170
// Gives ONE location of a particular file... if present
171
// if writable is true only a writable location is searched
172
// but, if no writable locations are found, the result is negative but may
173
// propose a non writable one as a bonus
174
bool
Locate
(
kXR_char
*path,
XrdClientLocate_Info
&resp,
175
bool
writable=
false
);
176
177
// Gives ALL the locations of a particular file... if present
178
bool
Locate
(
kXR_char
*path,
179
XrdClientVector<XrdClientLocate_Info>
&hosts)
180
{
181
return
Locate
( path, hosts, 0 );
182
}
183
184
bool
Locate
(
kXR_char
*path,
185
XrdClientVector<XrdClientLocate_Info>
&hosts,
186
int
opts );
187
188
189
bool
Truncate
(
const
char
*path,
long
long
newsize);
190
191
UnsolRespProcResult
ProcessUnsolicitedMsg
(
XrdClientUnsolMsgSender
*sender,
192
XrdClientMessage *unsolmsg);
193
194
};
195
#endif
Generated by
1.8.3.1