xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XrdClFileSystemUtils.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2014 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // This file is part of the XRootD software suite.
6 //
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // In applying this licence, CERN does not waive the privileges and immunities
21 // granted to it by virtue of its status as an Intergovernmental Organization
22 // or submit itself to any jurisdiction.
23 //------------------------------------------------------------------------------
24 
25 #ifndef __XRD_CL_FILE_SYSTEM_UTILS_HH__
26 #define __XRD_CL_FILE_SYSTEM_UTILS_HH__
27 
29 
30 #include <string>
31 #include <stdint.h>
32 
33 namespace XrdCl
34 {
35  class FileSystem;
36 
37  //----------------------------------------------------------------------------
40  //----------------------------------------------------------------------------
42  {
43  public:
44  //------------------------------------------------------------------------
46  //------------------------------------------------------------------------
47  class SpaceInfo
48  {
49  public:
50  SpaceInfo( uint64_t total, uint64_t free, uint64_t used,
51  uint64_t largestChunk ):
52  pTotal( total ), pFree( free ), pUsed( used ),
53  pLargestChunk( largestChunk ) { }
54 
55  //--------------------------------------------------------------------
57  //--------------------------------------------------------------------
58  uint64_t GetTotal() const { return pTotal; }
59 
60  //--------------------------------------------------------------------
62  //--------------------------------------------------------------------
63  uint64_t GetFree() const { return pFree; }
64 
65  //--------------------------------------------------------------------
67  //--------------------------------------------------------------------
68  uint64_t GetUsed() const { return pUsed; }
69 
70  //--------------------------------------------------------------------
72  //--------------------------------------------------------------------
73  uint64_t GetLargestFreeChunk() const { return pLargestChunk; }
74 
75  private:
76  uint64_t pTotal;
77  uint64_t pFree;
78  uint64_t pUsed;
79  uint64_t pLargestChunk;
80  };
81 
82  //------------------------------------------------------------------------
84  //------------------------------------------------------------------------
85  static XRootDStatus GetSpaceInfo( SpaceInfo *&result,
86  FileSystem *fs,
87  const std::string &path );
88  };
89 }
90 
91 #endif // __XRD_CL_FILE_SYSTEM_UTILS HH__
static XRootDStatus GetSpaceInfo(SpaceInfo *&result, FileSystem *fs, const std::string &path)
Recursively get space information for given path.
uint64_t GetUsed() const
Amount of used space in MB.
Definition: XrdClFileSystemUtils.hh:68
Container for space information.
Definition: XrdClFileSystemUtils.hh:47
uint64_t GetTotal() const
Amount of total space in MB.
Definition: XrdClFileSystemUtils.hh:58
uint64_t pTotal
Definition: XrdClFileSystemUtils.hh:76
Definition: XrdClFileSystemUtils.hh:41
uint64_t pUsed
Definition: XrdClFileSystemUtils.hh:78
SpaceInfo(uint64_t total, uint64_t free, uint64_t used, uint64_t largestChunk)
Definition: XrdClFileSystemUtils.hh:50
uint64_t pLargestChunk
Definition: XrdClFileSystemUtils.hh:79
Request status.
Definition: XrdClXRootDResponses.hh:212
uint64_t GetFree() const
Amount of free space in MB.
Definition: XrdClFileSystemUtils.hh:63
uint64_t GetLargestFreeChunk() const
Largest single chunk of free space.
Definition: XrdClFileSystemUtils.hh:73
uint64_t pFree
Definition: XrdClFileSystemUtils.hh:77
Send file/filesystem queries to an XRootD cluster.
Definition: XrdClFileSystem.hh:189