59 using namespace XrdCl;
61 Log *log = DefaultEnv::GetLog();
64 if(
stat( path.c_str(), &ssp ) == -1 )
69 return QueueTask( error, 0, handler );
73 uint32_t flags = S_ISDIR( ssp.st_mode ) ?
kXR_isDir : 0;
75 std::ostringstream data;
76 data << ssp.st_dev <<
" " << ssp.st_size <<
" " << flags <<
" "
83 log->
Error(
FileMsg,
"Stat: ParseServerResponse failed." );
90 resp->
Set( statInfo );
98 using namespace XrdCl;
100 Log *log = DefaultEnv::GetLog();
101 if(
unlink( path.c_str() ) )
106 return QueueTask( error, 0, handler );
112 static LocalFS& Instance()
114 static LocalFS instance;
123 LocalFS() : jmngr(
XrdCl::
DefaultEnv::GetPostMaster()->GetJobManager() )
131 LocalFS(
const LocalFS& );
136 LocalFS& operator=(
const LocalFS& );
146 using namespace XrdCl;
159 jmngr->QueueJob( task );
170 char GetCgiDelimiter(
bool &hasCgi )
183 std::string FilterXrdClCgi(
const std::string &path )
186 size_t pos = path.find(
'?' );
187 if( pos == std::string::npos )
190 std::string filteredPath = path.substr( 0 , pos );
191 std::string cgi = path.substr( pos + 1 );
195 size_t xrdcl = std::string::npos;
198 xrdcl = cgi.find(
"xrdcl.", pos );
200 if( xrdcl == std::string:: npos )
202 filteredPath += GetCgiDelimiter( hasCgi );
203 filteredPath += cgi.substr( pos );
210 filteredPath += GetCgiDelimiter( hasCgi );
211 filteredPath += cgi.substr( pos, xrdcl - 1 - pos );
214 pos = cgi.find(
'&', xrdcl );
215 if( pos != std::string::npos )
220 while( pos < cgi.size() && pos != std::string::npos );
235 pFS(fs), pUserHandler(userHandler) {}
237 virtual ~DeallocFSHandler()
248 pUserHandler->HandleResponse(status, response);
267 const std::string &path,
283 pExpires = ::time(
nullptr) + timeout;
302 using namespace XrdCl;
303 Log *log = DefaultEnv::GetLog();
309 if( !status->
IsOK() )
312 "response: %s",
this, pPath.c_str(),
313 status->
ToStr().c_str() );
321 "the initial location list: %s",
this, pPath.c_str(),
322 status->
ToStr().c_str() );
323 pHandler->HandleResponse( status, response );
338 "requests, give out what we've got",
this,
341 HandleFinalResponse();
352 response->
Get( info );
356 this, pPath.c_str(), info->
GetSize() );
358 for( it = info->
Begin(); it != info->
End(); ++it )
365 pLocations->Add( *it );
372 if( it->IsManager() )
376 if( pOutstanding == 0 ||
378 !fs->
Locate( pPath, pFlags,
new DeallocFSHandler(fs,
this),
379 pExpires-::time(0)).IsOK() )
396 HandleFinalResponse();
403 void HandleFinalResponse()
405 using namespace XrdCl;
410 if( !pLocations->GetSize() )
414 "No valid location found" ),
423 obj->
Set( pLocations );
427 pHandler->HandleResponse( st, obj );
435 uint16_t pOutstanding;
469 if( !status->
IsOK() )
472 pSync->TaskDone(
false );
478 response->
Get( info );
479 response->
Set( (
char*) 0 );
480 pList->At( pIndex )->SetStatInfo( info );
496 struct RecursiveDirListCtx
498 RecursiveDirListCtx(
const XrdCl::URL &url,
const std::string &path,
501 finalst( 0 ), pending( 1 ),
503 handler( handler ), flags( flags ),
506 dirList->SetParentName( path );
509 ~RecursiveDirListCtx()
518 using namespace XrdCl;
527 if( ( finalst->IsOK() && !st.
IsOK() ) ||
528 ( !finalst->IsOK() && st.
IsOK() ) )
549 RecursiveDirListHandler(
const XrdCl::URL &url,
550 const std::string &path,
557 expires = ::time( 0 ) + timeout;
558 pCtx =
new RecursiveDirListCtx( url, path, flags,
562 RecursiveDirListHandler( RecursiveDirListCtx *ctx ) : pCtx( ctx )
570 using namespace XrdCl;
572 Log *log = DefaultEnv::GetLog();
582 pCtx->UpdateStatus( *status );
588 response->
Get( dirList );
590 std::string
parent = pCtx->dirList->GetParentName();
593 for( itr = dirList->
Begin(); itr != dirList->
End(); ++itr )
599 log->
Error(
FileMsg,
"Recursive directory list operation for %s failed: "
600 "kXR_dirlist with stat operation not supported.",
608 path = path.substr(
parent.size() );
612 pCtx->dirList->Add( e );
625 RecursiveDirListHandler *handler =
new RecursiveDirListHandler( pCtx );
630 timeout = pCtx->expires - ::time( 0 );
633 log->
Error(
FileMsg,
"Recursive directory list operation for %s expired.",
644 log->
Error(
FileMsg,
"Recursive directory list operation for %s failed: %s",
646 pCtx->UpdateStatus( st );
654 if( pCtx->pending == 0 )
657 resp->
Set( pCtx->dirList );
659 pCtx->handler->HandleResponse( pCtx->finalst, resp );
667 else if( status->
IsOK() && ( pCtx->flags & DirListFlags::Chunked ) )
669 std::string
parent = pCtx->dirList->GetParentName();
671 resp->
Set( pCtx->dirList );
673 pCtx->dirList->SetParentName(
parent );
687 RecursiveDirListCtx *pCtx;
696 status( status ), response( response )
698 status = 0; response = 0;
722 allowChunked( allowChunked ), pHandler( handler )
736 if( !status->
IsOK() )
737 throw MergeDirLsErr( status, response );
740 throw MergeDirLsErr();
743 response->
Get( dirlist );
746 throw MergeDirLsErr();
749 MergeChunked( dirlist );
753 response->
Set( dirlist );
754 pHandler->HandleResponse( status, response );
756 catch(
const MergeDirLsErr &err )
758 delete status;
delete response;
759 pHandler->HandleResponse( err.status, err.response );
771 using namespace XrdCl;
773 std::set<ListEntry*, less> unique;
775 std::set<ListEntry*, less> tmp( response->
Begin(), response->
End() );
777 std::set_difference( tmp.begin(), tmp.end(),
778 uniquesofar.begin(), uniquesofar.end(),
779 std::inserter( unique, unique.end() ) );
783 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
785 ListEntry *ent = *itr;
786 if( !uniquesofar.count( ent ) )
788 StatInfo *info = ent->GetStatInfo() ?
new StatInfo( *ent->GetStatInfo() ) : 0;
789 ListEntry *newent =
new ListEntry( ent->GetHostAddress(), ent->GetName(), info );
790 uniquesofar.insert( newent );
796 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
798 ListEntry *entry = *itr;
799 dirlist->
Add(
new ListEntry( entry->GetHostAddress(),
801 entry->GetStatInfo() ) );
802 entry->SetStatInfo( 0 );
811 std::set<ListEntry*, less> unique( response->
Begin(), response->
End() );
815 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
817 ListEntry *entry = *itr;
818 dirlist->
Add(
new ListEntry( entry->GetHostAddress(),
820 entry->GetStatInfo() ) );
821 entry->SetStatInfo( 0 );
834 bool operator() (
const ListEntry *x,
const ListEntry *y)
const
836 if( x->GetName() != y->GetName() )
837 return x->
GetName() < y->GetName();
842 if( xStatInfo == yStatInfo )
863 std::set<ListEntry*, less> uniquesofar;
883 pFS(fs), pUserHandler(userHandler) {}
890 virtual void HandleResponseWithHosts(
XRootDStatus *status,
895 std::shared_ptr<FileSystemData> pFS;
910 pFS(fs), pUserHandler(userHandler) {}
917 virtual void HandleResponseWithHosts(
XRootDStatus *status,
922 std::shared_ptr<FileSystemData> pFS;
930 pLoadBalancerLookupDone( false ),
931 pFollowRedirects( true ),
932 pUrl( new
URL( url.GetURL() ) )
944 Log *log = DefaultEnv::GetLog();
951 handler = lastUrlHandler;
954 if( !fs->pLoadBalancerLookupDone && fs->pFollowRedirects )
962 auto st = MessageUtils::SendMessage( *fs->pUrl, msg, handler, params, 0 );
965 delete lastUrlHandler;
977 Log *log = DefaultEnv::GetLog();
980 if( pLoadBalancerLookupDone )
984 pUrl->GetHostId().c_str(), url.
GetHostId().c_str() );
986 pUrl.reset(
new URL( url ) );
987 pLoadBalancerLookupDone =
true;
995 Log *log = DefaultEnv::GetLog();
999 pUrl->GetHostId().c_str(), url.
GetHostId().c_str() );
1001 pLastUrl.reset(
new URL( url ) );
1031 if( status->
IsOK() )
1033 HostList::reverse_iterator it;
1034 for( it = hostList->rbegin(); it != hostList->rend(); ++it )
1035 if( it->loadBalancer )
1037 pFS->AssignLoadBalancer( it->url );
1051 pUserHandler->HandleResponseWithHosts( status, response, hostList );
1063 if( status->
IsOK() && hostList )
1064 pFS->AssignLastURL( hostList->front().url );
1075 pUserHandler->HandleResponseWithHosts( status, response, hostList );
1083 FileSystem::FileSystem(
const URL &url,
bool enablePlugIns ):
1093 std::string urlStr = url.
GetURL();
1100 log->
Error(
FileMsg,
"Plug-in factory failed to produce a plug-in "
1134 return pPlugIn->
Locate( path, flags, handler, timeout );
1136 std::string fPath = FilterXrdClCgi( path );
1144 req->
dlen = fPath.length();
1145 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1178 return Locate( path, flags,
1179 new DeepLocateHandler( handler, path, flags, timeout ), timeout );
1202 const std::string &dest,
1207 return pPlugIn->
Mv( source, dest, handler, timeout );
1209 std::string fSource = FilterXrdClCgi( source );
1210 std::string fDest = FilterXrdClCgi( dest );
1217 req->
dlen = fSource.length() + fDest.length()+1;
1218 req->
arg1len = fSource.length();
1219 msg->
Append( fSource.c_str(), fSource.length(), 24 );
1220 *msg->
GetBuffer(24 + fSource.length()) =
' ';
1221 msg->
Append( fDest.c_str(), fDest.length(), 25 + fSource.length() );
1234 const std::string &dest,
1238 Status st =
Mv( source, dest, &handler, timeout );
1254 return pPlugIn->
Query( queryCode, arg, handler, timeout );
1280 Status st =
Query( queryCode, arg, &handler, timeout );
1296 return pPlugIn->
Truncate( path, size, handler, timeout );
1298 std::string fPath = FilterXrdClCgi( path );
1306 req->
dlen = fPath.length();
1307 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1338 return pPlugIn->
Rm( path, handler, timeout );
1340 if( pImpl->
fsdata->pUrl->IsLocalFile() )
1341 return LocalFS::Instance().Rm( path, handler, timeout );
1343 std::string fPath = FilterXrdClCgi( path );
1350 req->
dlen = fPath.length();
1351 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1366 Status st =
Rm( path, &handler, timeout );
1383 return pPlugIn->
MkDir( path, flags, mode, handler, timeout );
1385 std::string fPath = FilterXrdClCgi( path );
1394 req->
dlen = fPath.length();
1395 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1412 Status st =
MkDir( path, flags, mode, &handler, timeout );
1427 return pPlugIn->
RmDir( path, handler, timeout );
1429 std::string fPath = FilterXrdClCgi( path );
1436 req->
dlen = fPath.length();
1437 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1468 return pPlugIn->
ChMod( path, mode, handler, timeout );
1470 std::string fPath = FilterXrdClCgi( path );
1478 req->
dlen = fPath.length();
1479 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1495 Status st =
ChMod( path, mode, &handler, timeout );
1509 return pPlugIn->
Ping( handler, timeout );
1544 return pPlugIn->
Stat( path, handler, timeout );
1546 if( pImpl->
fsdata->pUrl->IsLocalFile() )
1547 return LocalFS::Instance().Stat( path, handler, timeout );
1549 std::string fPath = FilterXrdClCgi( path );
1557 req->
dlen = fPath.length();
1558 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1589 return pPlugIn->
StatVFS( path, handler, timeout );
1591 std::string fPath = FilterXrdClCgi( path );
1599 req->
dlen = fPath.length();
1600 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1630 return pPlugIn->
Protocol( handler, timeout );
1668 return pPlugIn->
DirList( path, flags, handler, timeout );
1671 std::string fPath = FilterXrdClCgi( path );
1689 req->
dlen = fPath.length();
1698 handler =
new RecursiveDirListHandler( *pImpl->
fsdata->pUrl, url.
GetPath(), flags, handler, timeout );
1703 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1730 static const std::string zip_sufix =
".zip";
1731 if( path.size() >= zip_sufix.size() &&
1732 std::equal( zip_sufix.rbegin(), zip_sufix.rend(), path.rbegin() ) )
1740 bool isserver =
false;
1766 std::string locatePath =
"*"; locatePath += path;
1777 if( locations->
GetSize() == 0 )
1789 uint32_t errors = 0;
1790 uint32_t numLocations = locations->
GetSize();
1796 for( uint32_t i = 0; i < locations->
GetSize(); ++i )
1802 st = fs->
DirList( path, flags, currentResp, timeout );
1815 for( it = currentResp->
Begin(); it != currentResp->
End(); ++it )
1817 response->
Add( *it );
1830 MergeDirListHandler::Merge( response );
1832 if( errors || partial )
1834 if( errors == numLocations )
1865 uint32_t quota = response->
GetSize() <= 1024 ? response->
GetSize() : 1024;
1867 for( uint32_t i = 0; i < response->
GetSize(); ++i )
1870 ResponseHandler *handler =
new DirListStatHandler( response, i, &sync );
1871 st =
Stat( fullPath, handler, timeout );
1898 return SendSet(
"cache ", info, handler, timeout );
1924 return pPlugIn->
SendInfo( info, handler, timeout );
1925 return SendSet(
"monitor info ", info, handler, timeout );
1947 const std::string &info,
1954 size_t prefixLen = strlen( prefix );
1958 req->
dlen = info.length()+prefixLen;
1959 msg->
Append( prefix, prefixLen, 24 );
1960 msg->
Append( info.c_str(), info.length(), 24+prefixLen );
1978 return pPlugIn->
Prepare( fileList, flags, priority, handler, timeout );
1980 std::vector<std::string>::const_iterator it;
1982 for( it = fileList.begin(); it != fileList.end(); ++it )
1987 list.erase( list.length()-1, 1 );
1995 req->
optionX = 0xffff & ( flags >> 8 );
1996 req->
prty = priority;
1997 req->
dlen = list.length();
1999 msg->
Append( list.c_str(), list.length(), 24 );
2018 Status st =
Prepare( fileList, flags, priority, &handler, timeout );
2029 const std::vector<xattr_t> &attrs,
2036 return XAttrOperationImpl(
kXR_fattrSet, 0, path, attrs, handler, timeout );
2043 const std::vector<xattr_t> &attrs,
2044 std::vector<XAttrStatus> &result,
2052 std::vector<XAttrStatus> *resp = 0;
2054 if( resp ) result.swap( *resp );
2064 const std::vector<std::string> &attrs,
2071 return XAttrOperationImpl(
kXR_fattrGet, 0, path, attrs, handler, timeout );
2078 const std::vector<std::string> &attrs,
2079 std::vector<XAttr> &result,
2087 std::vector<XAttr> *resp = 0;
2089 if( resp ) result.swap( *resp );
2099 const std::vector<std::string> &attrs,
2106 return XAttrOperationImpl(
kXR_fattrDel, 0, path, attrs, handler, timeout );
2113 const std::vector<std::string> &attrs,
2114 std::vector<XAttrStatus> &result,
2122 std::vector<XAttrStatus> *resp = 0;
2124 if( resp ) result.swap( *resp );
2140 static const std::vector<std::string> nothing;
2142 path, nothing, handler, timeout );
2149 std::vector<XAttr> &result,
2157 std::vector<XAttr> *resp = 0;
2159 if( resp ) result.swap( *resp );
2169 const std::string &value )
2174 if( name ==
"FollowRedirects" )
2176 if( value ==
"true" ) pImpl->
fsdata->pFollowRedirects =
true;
2177 else pImpl->
fsdata->pFollowRedirects =
false;
2187 std::string &value )
const
2192 if( name ==
"FollowRedirects" )
2194 if( pImpl->
fsdata->pFollowRedirects ) value =
"true";
2195 else value =
"false";
2198 else if( name ==
"LastURL" )
2200 if( pImpl->
fsdata->pLastUrl )
2202 value = pImpl->
fsdata->pLastUrl->GetURL();
2214 template<
typename T>
2217 const std::string &path,
2218 const std::vector<T> &attrs,
2232 if( !st.
IsOK() )
return st;
2245 void FileSystem::Lock()
2247 pImpl->
fsdata->pMutex.Lock();
2253 void FileSystem::UnLock()
2255 pImpl->
fsdata->pMutex.UnLock();
#define kXR_PROTOCOLVERSION
int stat(const char *path, struct stat *buf)
int unlink(const char *path)
const char * XrdSysE2T(int errcode)
static int mapError(int rc)
void Set(Type object, bool own=true)
void Get(Type &object)
Retrieve the object being held.
Wrapper class used to assign a load balancer.
virtual ~AssignLBHandler()
AssignLBHandler(std::shared_ptr< FileSystemData > &fs, ResponseHandler *userHandler)
Wrapper class used to assign last URL.
virtual ~AssignLastURLHandler()
AssignLastURLHandler(std::shared_ptr< FileSystemData > &fs, ResponseHandler *userHandler)
Binary blob representation.
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
void Append(const char *buffer, uint32_t size)
Append data at the position pointed to by the append cursor.
uint32_t GetSize() const
Get the size of the message.
static PlugInManager * GetPlugInManager()
Get plug-in manager.
static Log * GetLog()
Get default log.
static PostMaster * GetPostMaster()
Get default post master.
static ForkHandler * GetForkHandler()
Get the fork handler.
static Env * GetEnv()
Get default client environment.
void SetStatInfo(StatInfo *info)
Set the stat info object (and transfer the ownership)
const std::string & GetHostAddress() const
Get host address.
const std::string & GetName() const
Get file name.
StatInfo * GetStatInfo()
Get the stat info object.
ListEntry * At(uint32_t index)
Get an entry at given index.
void Add(ListEntry *entry)
Add an entry to the list - takes ownership.
uint32_t GetSize() const
Get the size of the listing.
DirList::iterator Iterator
Directory listing iterator.
Iterator End()
Get the end iterator.
Iterator Begin()
Get the begin iterator.
const std::string & GetParentName() const
Get parent directory name.
void SetParentName(const std::string &parent)
Set name of the parent directory.
bool GetInt(const std::string &key, int &value)
virtual XRootDStatus Mv(const std::string &source, const std::string &dest, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Ping(ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus SendInfo(const std::string &info, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus DirList(const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus ChMod(const std::string &path, Access::Mode mode, ResponseHandler *handler, uint16_t timeout)
virtual bool GetProperty(const std::string &name, std::string &value) const
virtual XRootDStatus MkDir(const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Locate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus StatVFS(const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Protocol(ResponseHandler *handler, uint16_t timeout=0)
virtual XRootDStatus RmDir(const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual bool SetProperty(const std::string &name, const std::string &value)
virtual XRootDStatus Query(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Prepare(const std::vector< std::string > &fileList, PrepareFlags::Flags flags, uint8_t priority, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Rm(const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Stat(const std::string &path, ResponseHandler *handler, uint16_t timeout)
virtual XRootDStatus Truncate(const std::string &path, uint64_t size, ResponseHandler *handler, uint16_t timeout)
Send file/filesystem queries to an XRootD cluster.
XRootDStatus SetXAttr(const std::string &path, const std::vector< xattr_t > &attrs, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus RmDir(const std::string &path, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool SetProperty(const std::string &name, const std::string &value)
XRootDStatus Protocol(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus DirList(const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Mv(const std::string &source, const std::string &dest, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Query(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Locate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus SendInfo(const std::string &info, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Stat(const std::string &path, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Prepare(const std::vector< std::string > &fileList, PrepareFlags::Flags flags, uint8_t priority, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus ChMod(const std::string &path, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus DelXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus ListXAttr(const std::string &path, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Rm(const std::string &path, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
FileSystem(const URL &url, bool enablePlugIns=true)
XRootDStatus DeepLocate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus SendCache(const std::string &info, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus GetXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Ping(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Truncate(const std::string &path, uint64_t size, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool GetProperty(const std::string &name, std::string &value) const
XRootDStatus MkDir(const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus StatVFS(const std::string &path, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
void RegisterFileSystemObject(FileSystem *fs)
void UnRegisterFileSystemObject(FileSystem *fs)
Un-register a file system object.
const std::string & GetAddress() const
Get address.
uint32_t GetSize() const
Get number of locations.
Iterator Begin()
Get the location begin iterator.
Location & At(uint32_t index)
Get the location at index.
LocationList::iterator Iterator
Iterator over locations.
Iterator End()
Get the location end iterator.
void Error(uint64_t topic, const char *format,...)
Report an error.
void Dump(uint64_t topic, const char *format,...)
Print a dump message.
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
static void ProcessSendParams(MessageSendParams &sendParams)
Process sending params.
static Status CreateXAttrBody(Message *msg, const std::vector< T > &vec, const std::string &path="")
static XrdCl::XRootDStatus WaitForResponse(SyncResponseHandler *handler, Type *&response)
Wait for the response.
static void CreateRequest(Message *&msg, Request *&req, uint32_t payloadSize=0)
Create a message.
static XRootDStatus WaitForStatus(SyncResponseHandler *handler)
Wait and return the status of the query.
The message representation used throughout the system.
const std::string & GetObfuscatedDescription() const
Get the description of the message with authz parameter obfuscated.
virtual FileSystemPlugIn * CreateFileSystem(const std::string &url)=0
Create a file system plug-in for the given URL.
PlugInFactory * GetFactory(const std::string url)
Status QueryTransport(const URL &url, uint16_t query, AnyObject &result)
A helper running a fixed number of requests at a given time.
void WaitForAll()
Wait for all the requests to be finished.
void TaskDone(bool success=true)
Report the request finish.
uint32_t FailureCount() const
Number of tasks finishing with an error.
void WaitForQuota()
Wait for the request quota.
Handle an async response.
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
bool TestFlags(uint32_t flags) const
Test flags.
uint64_t GetSize() const
Get size (in bytes)
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
uint32_t GetFlags() const
Get flags.
Synchronize the response.
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Handle the response.
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
std::string GetURL() const
Get the URL.
std::string GetObfuscatedURL() const
Get the URL with authz information obfuscated.
void SetProtocol(const std::string &protocol)
Set protocol.
const std::string & GetPath() const
Get the path.
std::string ToStr() const
Convert to string.
static void SetDescription(Message *msg)
Get the description of a message.
const uint16_t errErrorResponse
const uint16_t errOperationExpired
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errNotFound
std::vector< HostInfo > HostList
const uint16_t errInternal
Internal error.
const uint16_t stOK
Everything went OK.
const int DefaultRequestTimeout
const uint16_t errNotSupported
const uint16_t errLocalError
const uint16_t suContinue
const uint64_t FileSystemMsg
@ Zip
List content of ZIP files.
@ Recursive
Do a recursive listing.
@ Cksm
Get checksum for every entry.
@ Chunked
Serve chunked results for better performance.
static XRootDStatus Send(std::shared_ptr< FileSystemData > &fs, Message *msg, ResponseHandler *handler, MessageSendParams ¶ms)
FileSystemData(const URL &url)
void AssignLastURL(const URL &url)
bool pLoadBalancerLookupDone
std::unique_ptr< URL > pLastUrl
std::unique_ptr< URL > pUrl
void AssignLoadBalancer(const URL &url)
Implementation holding the data members.
FileSystemImpl(const URL &url)
std::shared_ptr< FileSystemData > fsdata
Flags
Open flags, may be or'd when appropriate.
Code
XRootD query request codes.
Procedure execution status.
uint16_t code
Error type, or additional hints on what to do.
bool IsOK() const
We're fine.
std::string ToString() const
Create a string representation.
static const uint16_t ServerFlags
returns server flags