XRootD
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 <cstdint>
32 #include <memory>
33 
34 namespace XrdCl
35 {
36  class FileSystem;
37 
38  //----------------------------------------------------------------------------
41  //----------------------------------------------------------------------------
43  {
44  //------------------------------------------------------------------------
45  // Forward declaration for PIMPL
46  //------------------------------------------------------------------------
47  struct SpaceInfoImpl;
48 
49  public:
50  //------------------------------------------------------------------------
52  //------------------------------------------------------------------------
53  class SpaceInfo
54  {
55  public:
56  SpaceInfo( uint64_t total, uint64_t free, uint64_t used,
57  uint64_t largestChunk );
58 
59  ~SpaceInfo();
60 
61  //--------------------------------------------------------------------
63  //--------------------------------------------------------------------
64  uint64_t GetTotal() const;
65 
66  //--------------------------------------------------------------------
68  //--------------------------------------------------------------------
69  uint64_t GetFree() const;
70 
71  //--------------------------------------------------------------------
73  //--------------------------------------------------------------------
74  uint64_t GetUsed() const;
75 
76  //--------------------------------------------------------------------
78  //--------------------------------------------------------------------
79  uint64_t GetLargestFreeChunk() const;
80 
81  private:
82  std::unique_ptr<SpaceInfoImpl> pImpl;
83  };
84 
85  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
88  static XRootDStatus GetSpaceInfo( SpaceInfo *&result,
89  FileSystem *fs,
90  const std::string &path );
91  };
92 }
93 
94 #endif // __XRD_CL_FILE_SYSTEM_UTILS HH__
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.