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 <<
" "
78 log->
Debug( FileMsg,
"%s", data.str().c_str() );
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() )
311 log->
Dump( FileSystemMsg,
"[%p@DeepLocate(%s)] Got error "
312 "response: %s", (
void*)
this, pPath.c_str(),
313 status->
ToStr().c_str() );
320 log->
Debug( FileSystemMsg,
"[%p@DeepLocate(%s)] Failed to get "
321 "the initial location list: %s", (
void*)
this, pPath.c_str(),
322 status->
ToStr().c_str() );
323 pHandler->HandleResponse( status, response );
337 log->
Debug( FileSystemMsg,
"[%p@DeepLocate(%s)] No outstanding "
338 "requests, give out what we've got", (
void*)
this,
341 HandleFinalResponse();
352 response->
Get( info );
356 log->
Error(FileSystemMsg,
357 "[%p@DeepLocate(%s)] No locations received in response",
358 (
void*)
this, pPath.c_str());
362 log->
Dump( FileSystemMsg,
"[%p@DeepLocate(%s)] Got %d locations",
363 (
void*)
this, pPath.c_str(), info->
GetSize() );
365 for( it = info->
Begin(); it != info->
End(); ++it )
372 pLocations->Add( *it );
379 if( it->IsManager() )
383 if( pOutstanding == 0 ||
385 !fs->
Locate( pPath, pFlags,
new DeallocFSHandler(fs,
this),
386 pExpires-::time(0)).IsOK() )
403 HandleFinalResponse();
410 void HandleFinalResponse()
412 using namespace XrdCl;
417 if( !pLocations->GetSize() )
419 pHandler->HandleResponse(
new XRootDStatus( stError, errErrorResponse,
421 "No valid location found" ),
430 obj->
Set( pLocations );
434 pHandler->HandleResponse( st, obj );
442 uint16_t pOutstanding;
476 if( !status->
IsOK() )
479 pSync->TaskDone(
false );
485 response->
Get( info );
486 response->
Set( (
char*) 0 );
487 pList->At( pIndex )->SetStatInfo( info );
503 struct RecursiveDirListCtx
505 RecursiveDirListCtx(
const XrdCl::URL &url,
const std::string &path,
508 finalst( 0 ), pending( 1 ),
510 handler( handler ), flags( flags ),
513 dirList->SetParentName( path );
516 ~RecursiveDirListCtx()
525 using namespace XrdCl;
534 if( ( finalst->IsOK() && !st.
IsOK() ) ||
535 ( !finalst->IsOK() && st.
IsOK() ) )
556 RecursiveDirListHandler(
const XrdCl::URL &url,
557 const std::string &path,
564 expires = ::time( 0 ) + timeout;
565 pCtx =
new RecursiveDirListCtx( url, path, flags,
569 RecursiveDirListHandler( RecursiveDirListCtx *ctx ) : pCtx( ctx )
577 using namespace XrdCl;
579 Log *log = DefaultEnv::GetLog();
589 pCtx->UpdateStatus( *status );
595 response->
Get( dirList );
597 std::string
parent = pCtx->dirList->GetParentName();
600 for( itr = dirList->
Begin(); itr != dirList->
End(); ++itr )
606 log->
Error( FileMsg,
"Recursive directory list operation for %s failed: "
607 "kXR_dirlist with stat operation not supported.",
609 pCtx->UpdateStatus(
XRootDStatus( stError, errNotSupported ) );
615 path = path.substr(
parent.size() );
619 pCtx->dirList->Add( e );
630 | DirListFlags::Stat;
632 RecursiveDirListHandler *handler =
new RecursiveDirListHandler( pCtx );
637 timeout = pCtx->expires - ::time( 0 );
640 log->
Error( FileMsg,
"Recursive directory list operation for %s expired.",
642 pCtx->UpdateStatus(
XRootDStatus( stError, errOperationExpired ) );
651 log->
Error( FileMsg,
"Recursive directory list operation for %s failed: %s",
653 pCtx->UpdateStatus( st );
661 if( pCtx->pending == 0 )
664 resp->
Set( pCtx->dirList );
666 pCtx->handler->HandleResponse( pCtx->finalst, resp );
674 else if( status->
IsOK() && ( pCtx->flags & DirListFlags::Chunked ) )
676 std::string
parent = pCtx->dirList->GetParentName();
678 resp->
Set( pCtx->dirList );
680 pCtx->dirList->SetParentName(
parent );
681 pCtx->handler->HandleResponse(
new XRootDStatus( stOK, suContinue ), resp );
694 RecursiveDirListCtx *pCtx;
703 status( status ), response( response )
705 status = 0; response = 0;
729 allowChunked( allowChunked ), pHandler( handler )
743 if( !status->
IsOK() )
744 throw MergeDirLsErr( status, response );
747 throw MergeDirLsErr();
750 response->
Get( dirlist );
753 throw MergeDirLsErr();
756 MergeChunked( dirlist );
760 response->
Set( dirlist );
761 pHandler->HandleResponse( status, response );
763 catch(
const MergeDirLsErr &err )
765 delete status;
delete response;
766 pHandler->HandleResponse( err.status, err.response );
778 using namespace XrdCl;
780 std::set<ListEntry*, less> unique;
782 std::set<ListEntry*, less> tmp( response->
Begin(), response->
End() );
784 std::set_difference( tmp.begin(), tmp.end(),
785 uniquesofar.begin(), uniquesofar.end(),
786 std::inserter( unique, unique.end() ) );
790 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
792 ListEntry *ent = *itr;
793 if( !uniquesofar.count( ent ) )
795 StatInfo *info = ent->GetStatInfo() ?
new StatInfo( *ent->GetStatInfo() ) : 0;
796 ListEntry *newent =
new ListEntry( ent->GetHostAddress(), ent->GetName(), info );
797 uniquesofar.insert( newent );
803 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
805 ListEntry *entry = *itr;
806 dirlist->
Add(
new ListEntry( entry->GetHostAddress(),
808 entry->GetStatInfo() ) );
809 entry->SetStatInfo( 0 );
818 std::set<ListEntry*, less> unique( response->
Begin(), response->
End() );
822 for(
auto itr = unique.begin(); itr != unique.end(); ++itr )
824 ListEntry *entry = *itr;
825 dirlist->
Add(
new ListEntry( entry->GetHostAddress(),
827 entry->GetStatInfo() ) );
828 entry->SetStatInfo( 0 );
841 bool operator() (
const ListEntry *x,
const ListEntry *y)
const
843 if( x->GetName() != y->GetName() )
844 return x->
GetName() < y->GetName();
849 if( xStatInfo == yStatInfo )
870 std::set<ListEntry*, less> uniquesofar;
890 pFS(fs), pUserHandler(userHandler) {}
902 std::shared_ptr<FileSystemData> pFS;
917 pFS(fs), pUserHandler(userHandler) {}
929 std::shared_ptr<FileSystemData> pFS;
939 pUrl( new
URL( url.GetURL() ) )
958 handler = lastUrlHandler;
961 if( !fs->pLoadBalancerLookupDone && fs->pFollowRedirects )
972 delete lastUrlHandler;
1038 if( status->
IsOK() )
1040 HostList::reverse_iterator it;
1041 for( it = hostList->rbegin(); it != hostList->rend(); ++it )
1042 if( it->loadBalancer )
1044 pFS->AssignLoadBalancer( it->url );
1070 if( status->
IsOK() && hostList )
1071 pFS->AssignLastURL( hostList->front().url );
1100 std::string urlStr = url.
GetURL();
1107 log->
Error(
FileMsg,
"Plug-in factory failed to produce a plug-in "
1141 return pPlugIn->
Locate( path, flags, handler, timeout );
1143 std::string fPath = FilterXrdClCgi( path );
1151 req->
dlen = fPath.length();
1152 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1185 return Locate( path, flags,
1186 new DeepLocateHandler( handler, path, flags, timeout ), timeout );
1209 const std::string &dest,
1214 return pPlugIn->
Mv( source, dest, handler, timeout );
1216 std::string fSource = FilterXrdClCgi( source );
1217 std::string fDest = FilterXrdClCgi( dest );
1224 req->
dlen = fSource.length() + fDest.length()+1;
1225 req->
arg1len = fSource.length();
1226 msg->
Append( fSource.c_str(), fSource.length(), 24 );
1227 *msg->
GetBuffer(24 + fSource.length()) =
' ';
1228 msg->
Append( fDest.c_str(), fDest.length(), 25 + fSource.length() );
1241 const std::string &dest,
1245 Status st =
Mv( source, dest, &handler, timeout );
1261 return pPlugIn->
Query( queryCode, arg, handler, timeout );
1287 Status st =
Query( queryCode, arg, &handler, timeout );
1303 return pPlugIn->
Truncate( path, size, handler, timeout );
1305 std::string fPath = FilterXrdClCgi( path );
1313 req->
dlen = fPath.length();
1314 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1345 return pPlugIn->
Rm( path, handler, timeout );
1347 if( pImpl->
fsdata->pUrl->IsLocalFile() )
1348 return LocalFS::Instance().Rm( path, handler, timeout );
1350 std::string fPath = FilterXrdClCgi( path );
1357 req->
dlen = fPath.length();
1358 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1373 Status st =
Rm( path, &handler, timeout );
1390 return pPlugIn->
MkDir( path, flags, mode, handler, timeout );
1392 std::string fPath = FilterXrdClCgi( path );
1401 req->
dlen = fPath.length();
1402 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1419 Status st =
MkDir( path, flags, mode, &handler, timeout );
1434 return pPlugIn->
RmDir( path, handler, timeout );
1436 std::string fPath = FilterXrdClCgi( path );
1443 req->
dlen = fPath.length();
1444 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1475 return pPlugIn->
ChMod( path, mode, handler, timeout );
1477 std::string fPath = FilterXrdClCgi( path );
1485 req->
dlen = fPath.length();
1486 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1502 Status st =
ChMod( path, mode, &handler, timeout );
1516 return pPlugIn->
Ping( handler, timeout );
1551 return pPlugIn->
Stat( path, handler, timeout );
1553 if( pImpl->
fsdata->pUrl->IsLocalFile() )
1554 return LocalFS::Instance().Stat( path, handler, timeout );
1556 std::string fPath = FilterXrdClCgi( path );
1564 req->
dlen = fPath.length();
1565 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1596 return pPlugIn->
StatVFS( path, handler, timeout );
1598 std::string fPath = FilterXrdClCgi( path );
1606 req->
dlen = fPath.length();
1607 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1637 return pPlugIn->
Protocol( handler, timeout );
1675 return pPlugIn->
DirList( path, flags, handler, timeout );
1678 std::string fPath = FilterXrdClCgi( path );
1696 req->
dlen = fPath.length();
1705 handler =
new RecursiveDirListHandler( *pImpl->
fsdata->pUrl, url.
GetPath(), flags, handler, timeout );
1710 msg->
Append( fPath.c_str(), fPath.length(), 24 );
1737 static const std::string zip_sufix =
".zip";
1738 if( path.size() >= zip_sufix.size() &&
1739 std::equal( zip_sufix.rbegin(), zip_sufix.rend(), path.rbegin() ) )
1747 bool isserver =
false;
1773 std::string locatePath =
"*"; locatePath += path;
1784 if( locations->
GetSize() == 0 )
1796 uint32_t errors = 0;
1797 uint32_t numLocations = locations->
GetSize();
1803 for( uint32_t i = 0; i < locations->
GetSize(); ++i )
1809 st = fs->
DirList( path, flags, currentResp, timeout );
1822 for( it = currentResp->
Begin(); it != currentResp->
End(); ++it )
1824 response->
Add( *it );
1837 MergeDirListHandler::Merge( response );
1839 if( errors || partial )
1841 if( errors == numLocations )
1872 uint32_t quota = response->
GetSize() <= 1024 ? response->
GetSize() : 1024;
1874 for( uint32_t i = 0; i < response->
GetSize(); ++i )
1877 ResponseHandler *handler =
new DirListStatHandler( response, i, &sync );
1878 st =
Stat( fullPath, handler, timeout );
1905 return SendSet(
"cache ", info, handler, timeout );
1931 return pPlugIn->
SendInfo( info, handler, timeout );
1932 return SendSet(
"monitor info ", info, handler, timeout );
1954 const std::string &info,
1961 size_t prefixLen = strlen( prefix );
1965 req->
dlen = info.length()+prefixLen;
1966 msg->
Append( prefix, prefixLen, 24 );
1967 msg->
Append( info.c_str(), info.length(), 24+prefixLen );
1985 return pPlugIn->
Prepare( fileList, flags, priority, handler, timeout );
1987 std::vector<std::string>::const_iterator it;
1989 for( it = fileList.begin(); it != fileList.end(); ++it )
1994 list.erase( list.length()-1, 1 );
2002 req->
optionX = 0xffff & ( flags >> 8 );
2003 req->
prty = priority;
2004 req->
dlen = list.length();
2006 msg->
Append( list.c_str(), list.length(), 24 );
2025 Status st =
Prepare( fileList, flags, priority, &handler, timeout );
2036 const std::vector<xattr_t> &attrs,
2043 return XAttrOperationImpl(
kXR_fattrSet, 0, path, attrs, handler, timeout );
2050 const std::vector<xattr_t> &attrs,
2051 std::vector<XAttrStatus> &result,
2059 std::vector<XAttrStatus> *resp = 0;
2061 if( resp ) result.swap( *resp );
2071 const std::vector<std::string> &attrs,
2078 return XAttrOperationImpl(
kXR_fattrGet, 0, path, attrs, handler, timeout );
2085 const std::vector<std::string> &attrs,
2086 std::vector<XAttr> &result,
2094 std::vector<XAttr> *resp = 0;
2096 if( resp ) result.swap( *resp );
2106 const std::vector<std::string> &attrs,
2113 return XAttrOperationImpl(
kXR_fattrDel, 0, path, attrs, handler, timeout );
2120 const std::vector<std::string> &attrs,
2121 std::vector<XAttrStatus> &result,
2129 std::vector<XAttrStatus> *resp = 0;
2131 if( resp ) result.swap( *resp );
2147 static const std::vector<std::string> nothing;
2149 path, nothing, handler, timeout );
2156 std::vector<XAttr> &result,
2164 std::vector<XAttr> *resp = 0;
2166 if( resp ) result.swap( *resp );
2176 const std::string &value )
2181 if( name ==
"FollowRedirects" )
2183 if( value ==
"true" ) pImpl->
fsdata->pFollowRedirects =
true;
2184 else pImpl->
fsdata->pFollowRedirects =
false;
2194 std::string &value )
const
2199 if( name ==
"FollowRedirects" )
2201 if( pImpl->
fsdata->pFollowRedirects ) value =
"true";
2202 else value =
"false";
2205 else if( name ==
"LastURL" )
2207 if( pImpl->
fsdata->pLastUrl )
2209 value = pImpl->
fsdata->pLastUrl->GetURL();
2221 template<
typename T>
2224 const std::string &path,
2225 const std::vector<T> &attrs,
2239 if( !st.
IsOK() )
return st;
2252 void FileSystem::Lock()
2254 pImpl->
fsdata->pMutex.Lock();
2260 void FileSystem::UnLock()
2262 pImpl->
fsdata->pMutex.UnLock();
#define kXR_PROTOCOLVERSION
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)
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Wrapper class used to assign last URL.
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
virtual ~AssignLastURLHandler()
AssignLastURLHandler(std::shared_ptr< FileSystemData > &fs, ResponseHandler *userHandler)
Binary blob representation.
void Append(const char *buffer, uint32_t size)
Append data at the position pointed to by the append cursor.
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
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 & GetName() const
Get file name.
const std::string & GetHostAddress() const
Get host address.
StatInfo * GetStatInfo()
Get the stat info object.
void Add(ListEntry *entry)
Add an entry to the list - takes ownership.
uint32_t GetSize() const
Get the size of the listing.
const std::string & GetParentName() const
Get parent directory name.
Iterator End()
Get the end iterator.
DirList::iterator Iterator
Directory listing iterator.
Iterator Begin()
Get the begin iterator.
void SetParentName(const std::string &parent)
Set name of the parent directory.
ListEntry * At(uint32_t index)
Get an entry at given index.
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 UnRegisterFileSystemObject(FileSystem *fs)
Un-register a file system object.
const std::string & GetAddress() const
Get address.
LocationList::iterator Iterator
Iterator over locations.
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.
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 XRootDStatus SendMessage(const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams, LocalFileHandler *lFileHandler)
Send message.
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.
const std::string & GetPath() const
Get the path.
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.
std::string ToStr() const
Convert to string.
static void SetDescription(Message *msg)
Get the description of a message.
SendInfoImpl< false > SendInfo
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errNotFound
LocateImpl< false > Locate
std::vector< HostInfo > HostList
const uint16_t errInternal
Internal error.
const uint16_t stOK
Everything went OK.
DeepLocateImpl< false > DeepLocate
ProtocolImpl< false > Protocol
const int DefaultRequestTimeout
const uint16_t errNotSupported
PrepareImpl< false > Prepare
StatVFSImpl< false > StatVFS
const uint16_t suContinue
DirListImpl< false > DirList
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