xrootd
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
41#include "XrdOuc/XrdOucHash.hh"
43
46
47void joinStrings(XrdOucString &buf, vecString &vs, int startidx = 0, int endidx=-1);
48
50 enum {
57
59
61};
62
64
66 bool DirList_low(const char *dir, vecString &entries);
69 bool writable, int opts, bool all = false);
70 protected:
71
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 {
111 long long size;
112 long id;
113 long flags;
115 };
116 bool DirList(const char *dir,
117 XrdClientVector<DirListInfo> &dirlistinfo,
118 bool askallservers=false);
119
121 vecBool&);
122
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
135 kXR_char **chksum);
136
137 // Quickly jump to the former redirector. Useful after having been redirected.
139
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
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
175 bool writable=false);
176
177 // Gives ALL the locations of a particular file... if present
178 bool Locate(kXR_char *path,
180 {
181 return Locate( path, hosts, 0 );
182 }
183
184 bool Locate(kXR_char *path,
186 int opts );
187
188
189 bool Truncate(const char *path, long long newsize);
190
192 XrdClientMessage *unsolmsg);
193
194};
195#endif
int kXR_int32
Definition: XPtypes.hh:89
unsigned char kXR_char
Definition: XPtypes.hh:65
XrdClientVector< XrdOucString > vecString
Definition: XrdClientAdmin.hh:44
XrdClientVector< bool > vecBool
Definition: XrdClientAdmin.hh:45
void joinStrings(XrdOucString &buf, vecString &vs, int startidx=0, int endidx=-1)
UnsolRespProcResult
Definition: XrdClientUnsolMsg.hh:43
Definition: XrdClientAbs.hh:49
Definition: XrdClientAdmin.hh:63
bool DirList(const char *dir, XrdClientVector< DirListInfo > &dirlistinfo, bool askallservers=false)
bool Stat(const char *fname, long &id, long long &size, long &flags, long &modtime)
bool CanRedirOnError()
Definition: XrdClientAdmin.hh:72
bool Rmdir(const char *path)
bool Mkdir(const char *dir, int user, int group, int other)
virtual ~XrdClientAdmin()
bool ExistFiles(vecString &, vecBool &)
bool Locate(kXR_char *path, XrdClientLocate_Info &resp, bool writable=false)
bool DirList_low(const char *dir, vecString &entries)
bool Locate(kXR_char *path, XrdClientVector< XrdClientLocate_Info > &hosts)
Definition: XrdClientAdmin.hh:178
long GetChecksum(kXR_char *path, kXR_char **chksum)
bool Protocol(kXR_int32 &proto, kXR_int32 &kind)
void GoBackToRedirector()
bool Truncate(const char *path, long long newsize)
bool GetSpaceInfo(const char *logicalname, long long &totspace, long long &totfree, long long &totused, long long &largestchunk)
bool Locate(kXR_char *path, XrdClientVector< XrdClientLocate_Info > &hosts, int opts)
bool Prepare(vecString vs, kXR_char opts, kXR_char prty)
int LocalLocate(kXR_char *path, XrdClientVector< XrdClientLocate_Info > &res, bool writable, int opts, bool all=false)
UnsolRespProcResult ProcessUnsolicitedMsg(XrdClientUnsolMsgSender *sender, XrdClientMessage *unsolmsg)
bool Mv(const char *fileSrc, const char *fileDest)
bool SysStatX(const char *paths_list, kXR_char *binInfo)
bool IsFileOnline(vecString &, vecBool &)
bool DirList(const char *dir, vecString &entries, bool askallservers=false)
bool OpenFileWhenRedirected(char *, bool &)
bool Prepare(const char *paths, kXR_char opts, kXR_char prty)
bool Stat_vfs(const char *fname, int &rwservers, long long &rwfree, int &rwutil, int &stagingservers, long long &stagingfree, int &stagingutil)
bool Rm(const char *file)
bool ExistDirs(vecString &, vecBool &)
XrdOucString fInitialUrl
Definition: XrdClientAdmin.hh:65
XrdClientAdmin(const char *url)
bool Chmod(const char *file, int user, int group, int other)
Definition: XrdClientMessage.hh:49
Definition: XrdClientUnsolMsg.hh:63
Definition: XrdOucString.hh:254
Definition: XrdClientAdmin.hh:108
XrdOucString host
Definition: XrdClientAdmin.hh:110
XrdOucString fullpath
Definition: XrdClientAdmin.hh:109
long long size
Definition: XrdClientAdmin.hh:111
long flags
Definition: XrdClientAdmin.hh:113
long id
Definition: XrdClientAdmin.hh:112
long modtime
Definition: XrdClientAdmin.hh:114
Definition: XrdClientAdmin.hh:49
bool CanWrite
Definition: XrdClientAdmin.hh:58
@ kXrdcLocManager
Definition: XrdClientAdmin.hh:54
@ kXrdcLocManagerPending
Definition: XrdClientAdmin.hh:55
@ kXrdcLocNone
Definition: XrdClientAdmin.hh:51
@ kXrdcLocDataServerPending
Definition: XrdClientAdmin.hh:53
@ kXrdcLocDataServer
Definition: XrdClientAdmin.hh:52
enum XrdClientLocate_Info::@48 Infotype
kXR_char Location[256]
Definition: XrdClientAdmin.hh:60