XRootD
XrdPfc::DataFsSnapshot Struct Reference

#include <XrdPfcDirStateSnapshot.hh>

+ Inheritance diagram for XrdPfc::DataFsSnapshot:
+ Collaboration diagram for XrdPfc::DataFsSnapshot:

Public Member Functions

 DataFsSnapshot ()
 
 DataFsSnapshot (const DataFsState &b)
 
void dump ()
 
void write_json_file (const std::string &fname, bool include_preamble)
 

Public Attributes

std::vector< DirStateElementm_dir_states
 
- Public Attributes inherited from XrdPfc::DataFsStateBase
long long m_disk_total = 0
 
long long m_disk_used = 0
 
long long m_file_usage = 0
 
long long m_meta_total = 0
 
long long m_meta_used = 0
 
time_t m_stats_reset_time = 0
 
time_t m_usage_update_time = 0
 

Detailed Description

Definition at line 34 of file XrdPfcDirStateSnapshot.hh.

Constructor & Destructor Documentation

◆ DataFsSnapshot() [1/2]

XrdPfc::DataFsSnapshot::DataFsSnapshot ( )
inline

Definition at line 38 of file XrdPfcDirStateSnapshot.hh.

38 {}

◆ DataFsSnapshot() [2/2]

XrdPfc::DataFsSnapshot::DataFsSnapshot ( const DataFsState b)
inline

Definition at line 39 of file XrdPfcDirStateSnapshot.hh.

39  :
40  DataFsStateBase(b)
41  {}

Member Function Documentation

◆ dump()

void DataFsSnapshot::dump ( )

Definition at line 85 of file XrdPfcDirStateSnapshot.cc.

86 {
87  nlohmann::ordered_json j; // = *this;
88  to_json(j, *this);
89  std::cout << j.dump(3) << "\n";
90 }

◆ write_json_file()

void DataFsSnapshot::write_json_file ( const std::string &  fname,
bool  include_preamble 
)

Definition at line 58 of file XrdPfcDirStateSnapshot.cc.

59 {
60  // Throws exception on failed file-open.
61 
62  std::ofstream ofs;
63  open_ofstream(ofs, fname, __func__);
64 
65  if (include_preamble)
66  {
67  ofs << "{ \"dirstate_snapshot\": ";
68  }
69 
70  nlohmann::ordered_json j;
71  to_json(j, *this);
72 
73  ofs << std::setw(1);
74  ofs << j;
75 
76  if (include_preamble)
77  {
78  ofs << " }";
79  }
80 
81  ofs << "\n";
82  ofs.close();
83 }

Member Data Documentation

◆ m_dir_states

std::vector<DirStateElement> XrdPfc::DataFsSnapshot::m_dir_states

Definition at line 36 of file XrdPfcDirStateSnapshot.hh.


The documentation for this struct was generated from the following files: