42 uint64_t largestChunk ):
60 uint64_t largestChunk ):
92 return pImpl->pLargestChunk;
100 const std::string &path )
110 std::unique_ptr<LocationInfo> locationInfoPtr( locationInfo );
114 std::vector<std::pair<std::string, uint64_t> > resp;
115 resp.push_back( std::make_pair( std::string(
"oss.space"), (uint64_t)0 ) );
116 resp.push_back( std::make_pair( std::string(
"oss.free"), (uint64_t)0 ) );
117 resp.push_back( std::make_pair( std::string(
"oss.used"), (uint64_t)0 ) );
118 resp.push_back( std::make_pair( std::string(
"oss.maxf"), (uint64_t)0 ) );
125 for( it = locationInfo->
Begin(); it != locationInfo->
End(); ++it )
136 std::unique_ptr<Buffer> spaceInfoPtr( spaceInfo );
141 std::string fakeUrl =
"root://fake/fake?" + spaceInfo->
ToString();
153 for(
size_t i = 0; i < resp.size(); ++i )
155 URL::ParamsMap::iterator paramIt = params.find( resp[i].first );
156 if( paramIt == params.end() )
return st;
158 uint64_t num = ::strtoll( paramIt->second.c_str(), &res, 0 );
159 if( *res != 0 )
return st;
160 if( resp[i].first ==
"oss.maxf" )
161 {
if( num > resp[i].second ) resp[i].second = num; }
163 resp[i].second += num;
167 result =
new SpaceInfo( resp[0].second, resp[1].second, resp[2].second,
Binary blob representation.
void FromString(const std::string str)
Fill the buffer from a string.
std::string ToString() const
Convert the buffer to a string.
Container for space information.
uint64_t GetUsed() const
Amount of used space in MB.
uint64_t GetLargestFreeChunk() const
Largest single chunk of free space.
uint64_t GetTotal() const
Amount of total space in MB.
uint64_t GetFree() const
Amount of free space in MB.
SpaceInfo(uint64_t total, uint64_t free, uint64_t used, uint64_t largestChunk)
static XRootDStatus GetSpaceInfo(SpaceInfo *&result, FileSystem *fs, const std::string &path)
Recursively get space information for given path.
Send file/filesystem queries to an XRootD cluster.
XRootDStatus Query(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus DeepLocate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Iterator Begin()
Get the location begin iterator.
LocationList::iterator Iterator
Iterator over locations.
Iterator End()
Get the location end iterator.
std::map< std::string, std::string > ParamsMap
const ParamsMap & GetParams() const
Get the URL params.
bool IsValid() const
Is the url valid.
const uint16_t stError
An error occurred that could potentially be retried.
const uint16_t errInvalidResponse
SpaceInfoImpl(uint64_t total, uint64_t free, uint64_t used, uint64_t largestChunk)
@ Space
Query logical space stats.
uint16_t code
Error type, or additional hints on what to do.
bool IsOK() const
We're fine.