6 #include "XrdOuc/XrdOucJson.hh"
18 #define PFC_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
19 inline void to_json(nlohmann::json &nlohmann_json_j, const Type &nlohmann_json_t) { \
20 NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
22 inline void from_json(const nlohmann::json &nlohmann_json_j, Type &nlohmann_json_t) { \
23 NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
25 inline void to_json(nlohmann::ordered_json &nlohmann_json_j, const Type &nlohmann_json_t) { \
26 NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
28 inline void from_json(const nlohmann::ordered_json &nlohmann_json_j, Type &nlohmann_json_t) { \
29 NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
35 m_NumIos, m_Duration, m_BytesHit, m_BytesMissed, m_BytesBypassed, m_BytesWritten, m_StBlocksAdded, m_NCksumErrors,
36 m_StBlocksRemoved, m_NFilesOpened, m_NFilesClosed, m_NFilesCreated, m_NFilesRemoved, m_NDirectoriesCreated, m_NDirectoriesRemoved)
40 m_dir_name, m_stats, m_usage,
41 m_parent, m_daughters_begin, m_daughters_end)
67 const char *m_traceID =
"DirStateSnapshot";
77 const char* size_str =
"524288";
78 myEnv.
Put(
"oss.asize", size_str);
91 if ((cret = myFile->
Open(file_path.c_str(), O_RDWR, mode, myEnv)) !=
XrdOssOK)
99 std::ostringstream os;
101 if (include_preamble)
103 os <<
"{ \"dirstate_snapshot\": ";
106 nlohmann::ordered_json j;
112 if (include_preamble)
119 myFile->
Write(os.str().c_str(), 0, os.str().size());
120 myFile->
Close();
delete myFile;
129 myFile->
Close();
delete myFile;
134 if ((cret = myInfoFile->
Open(cinfo_path.c_str(), O_RDWR, mode, myEnv)) !=
XrdOssOK)
138 myFile->
Close();
delete myFile;
144 Info myInfo(GetTrace(),
false);
148 myInfo.
Write(myInfoFile, cinfo_path.c_str());
155 nlohmann::ordered_json j;
157 std::cout << j.dump(3) <<
"\n";
#define ERRNO_AND_ERRSTR(err_code)
virtual int Ftruncate(unsigned long long flen)
virtual int Close(long long *retsz=0)=0
virtual int Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env)
virtual ssize_t Write(const void *buffer, off_t offset, size_t size)
virtual int Create(const char *tid, const char *path, mode_t mode, XrdOucEnv &env, int opts=0)=0
virtual XrdOssDF * newFile(const char *tident)=0
void Put(const char *varname, const char *value)
static const Configuration & Conf()
static Cache & GetInstance()
Singleton access.
Status of cached file. Can be read from and written into a binary file.
static const char * s_infoExtension
bool Write(XrdOssDF *fp, const char *dname, const char *fname=0)
void SetAllBitsSynced()
Mark all blocks as synced to disk.
void SetBufferSizeFileSizeAndCreationTime(long long bs, long long fs)
m_NDirectories m_sshot_stats_reset_time
m_NDirectories m_usage_update_time
m_NDirectories m_meta_total
m_NDirectories m_meta_used
m_NDirectories m_disk_used
m_NDirectories m_disk_total
PFC_DEFINE_TYPE_NON_INTRUSIVE(DirStats, m_NumIos, m_Duration, m_BytesHit, m_BytesMissed, m_BytesBypassed, m_BytesWritten, m_StBlocksAdded, m_NCksumErrors, m_StBlocksRemoved, m_NFilesOpened, m_NFilesClosed, m_NFilesCreated, m_NFilesRemoved, m_NDirectoriesCreated, m_NDirectoriesRemoved) PFC_DEFINE_TYPE_NON_INTRUSIVE(DirUsage
m_NDirectories m_file_usage
Contains parameters configurable from the xrootd config file.
std::string m_data_space
oss space for data files
std::string m_username
username passed to oss plugin
void write_json_file(const std::string &fname, XrdOss &oss, bool include_preamble)