XRootD
XrdPfcDirStateSnapshot.hh
Go to the documentation of this file.
1 #ifndef __XRDPFC_DIRSTATESNAPSHOT_HH__
2 #define __XRDPFC_DIRSTATESNAPSHOT_HH__
3 
4 #include "XrdPfcDirState.hh"
5 
6 #include <vector>
7 
8 //==============================================================================
9 // Structs for DirState export in vector form
10 //==============================================================================
11 
12 namespace XrdPfc
13 {
14 
15 // For usage / stat reporting
16 
18 {
21 
22  int m_parent = -1;
24 
26  DirStateElement(const DirState &b, int parent) :
27  DirStateBase(b),
28  m_stats(b.m_here_stats, b.m_recursive_subdir_stats),
29  m_usage(b.m_here_usage, b.m_recursive_subdir_usage),
31  {}
32 };
33 
35 {
36  std::vector<DirStateElement> m_dir_states;
37 
41  {}
42 
43  // Import of data into vector form is implemented in ResourceMonitor
44  // in order to avoid dependence of this struct on DirState.
45 
46  void write_json_file(const std::string &fname, bool include_preamble);
47  void dump();
48 };
49 
50 // For purge planning & execution
51 
53 {
55 
56  int m_parent = -1;
58 
60  DirPurgeElement(const DirState &b, int parent) :
61  DirStateBase(b),
62  m_usage(b.m_here_usage, b.m_recursive_subdir_usage),
64  {}
65 };
66 
68 {
69  long long m_bytes_to_remove = 0;
71 
72  bool m_space_based_purge = false;
73  bool m_age_based_purge = false;
74 
75  std::vector<DirPurgeElement> m_dir_vec;
76  // could have parallel vector of DirState* ... or store them in the DirPurgeElement.
77  // requires some interlock / ref-counting with the source tree.
78  // or .... just block DirState removal for the duration of the purge :) Yay.
79 
83  {}
84 
85  int find_dir_entry_from_tok(int entry, PathTokenizer &pt, int pos, int *last_existing_entry) const;
86 
87  int find_dir_entry_for_dir_path(const std::string &dir_path) const;
88 
89  const DirUsage* find_dir_usage_for_dir_path(const std::string &dir_path) const;
90 };
91 
92 }
93 
94 #endif
static void parent()
Definition: XrdPfc.hh:41
int find_dir_entry_from_tok(int entry, PathTokenizer &pt, int pos, int *last_existing_entry) const
std::vector< DirPurgeElement > m_dir_vec
int find_dir_entry_for_dir_path(const std::string &dir_path) const
const DirUsage * find_dir_usage_for_dir_path(const std::string &dir_path) const
DataFsPurgeshot(const DataFsState &b)
void write_json_file(const std::string &fname, bool include_preamble)
std::vector< DirStateElement > m_dir_states
DataFsSnapshot(const DataFsState &b)
DirPurgeElement(const DirState &b, int parent)
DirStateElement(const DirState &b, int parent)