XRootD
XrdPfcDirStateBase.hh
Go to the documentation of this file.
1 #ifndef __XRDPFC_DIRSTATEBASE_HH__
2 #define __XRDPFC_DIRSTATEBASE_HH__
3 
4 #include <XrdPfc/XrdPfcStats.hh>
5 #include <ctime>
6 #include <string>
7 
8 namespace XrdPfc
9 {
10 
11 //==============================================================================
12 // Data-holding struct DirUsage -- complementary to Stats.
13 //==============================================================================
14 
15 struct DirUsage
16 {
17  time_t m_LastOpenTime = 0;
18  time_t m_LastCloseTime = 0;
19  long long m_StBlocks = 0;
20  int m_NFilesOpen = 0;
21  int m_NFiles = 0;
22  int m_NDirectories = 0;
23 
24  DirUsage() = default;
25 
26  DirUsage(const DirUsage& s) = default;
27 
28  DirUsage& operator=(const DirUsage&) = default;
29 
30  DirUsage(const DirUsage &a, const DirUsage &b) :
35  m_NFiles (a.m_NFiles + b.m_NFiles),
37  {}
38 
39  void update_from_stats(const DirStats& s)
40  {
45  }
46 
47  void update_last_times(const DirUsage& u)
48  {
51  }
52 };
53 
54 
55 //==============================================================================
56 // Base classes, shared between in-memory tree form and snap-shot vector forms.
57 //==============================================================================
58 
60 {
61  std::string m_dir_name;
62 
64  DirStateBase(const std::string &dname) : m_dir_name(dname) {}
65 };
66 
68 {
69  time_t m_usage_update_time = 0;
70 
71  long long m_disk_total = 0; // In bytes, from Oss::StatVS() on space data
72  long long m_disk_used = 0; // ""
73  long long m_file_usage = 0; // Calculate usage by data files in the cache
74  long long m_meta_total = 0; // In bytes, from Oss::StatVS() on space meta
75  long long m_meta_used = 0; // ""
76 };
77 
78 }
79 
80 #endif
long long m_StBlocksRemoved
Definition: XrdPfcStats.hh:149
long long m_StBlocksAdded
number of 512-byte blocks the file has grown by
Definition: XrdPfcStats.hh:43
Definition: XrdPfc.hh:41
DirStateBase(const std::string &dname)
DirUsage & operator=(const DirUsage &)=default
DirUsage(const DirUsage &s)=default
void update_from_stats(const DirStats &s)
DirUsage(const DirUsage &a, const DirUsage &b)
void update_last_times(const DirUsage &u)
DirUsage()=default