Loading...
Searching...
No Matches
XrdPfcFPurgeState.hh
Go to the documentation of this file.
#ifndef __XRDPFC_FPURGESTATE_HH__
#define __XRDPFC_FPURGESTATE_HH__
#include <ctime>
#include <list>
#include <map>
#include <string>
#include <sys/stat.h>
class XrdOss;
namespace XrdPfc {
class Info;
class FsTraversal;
//==============================================================================
// FPurgeState
//==============================================================================
class FPurgeState
{
public:
struct PurgeCandidate // unknown meaning, "file that is candidate for purge", PurgeCandidate would be better.
{
std::string path;
long long nStBlocks;
time_t time;
PurgeCandidate(const std::string &dname, const char *fname, long long n, time_t t) :
path(dname + fname), nStBlocks(n), time(t)
{}
};
using list_t = std::list<PurgeCandidate>;
using list_i = list_t::iterator;
using map_t = std::multimap<time_t, PurgeCandidate>;
using map_i = map_t::iterator;
private:
XrdOss &m_oss;
long long m_nStBlocksReq;
long long m_nStBlocksAccum;
long long m_nStBlocksTotal;
time_t m_tMinTimeStamp;
time_t m_tMinUVKeepTimeStamp;
static const char *m_traceID;
list_t m_flist; // list of files to be removed unconditionally
map_t m_fmap; // map of files that are purge candidates
public:
FPurgeState(long long iNBytesReq, XrdOss &oss);
map_t &refMap() { return m_fmap; }
list_t &refList() { return m_flist; }
void setMinTime(time_t min_time) { m_tMinTimeStamp = min_time; }
time_t getMinTime() const { return m_tMinTimeStamp; }
void setUVKeepMinTime(time_t min_time) { m_tMinUVKeepTimeStamp = min_time; }
long long getNStBlocksTotal() const { return m_nStBlocksTotal; }
long long getNBytesTotal() const { return 512ll * m_nStBlocksTotal; }
void MoveListEntriesToMap();
void CheckFile(const FsTraversal &fst, const char *fname, time_t atime, struct stat &fstat);
void ProcessDirAndRecurse(FsTraversal &fst);
bool TraverseNamespace(const char *root_path);
};
} // namespace XrdPfc
#endif
fstat
#define fstat(a, b)
Definition XrdPosix.hh:62
stat
#define stat(a, b)
Definition XrdPosix.hh:101
XrdOss
Definition XrdOss.hh:499
XrdPfc::FPurgeState::getNStBlocksTotal
long long getNStBlocksTotal() const
Definition XrdPfcFPurgeState.hh:64
XrdPfc::FPurgeState::refList
list_t & refList()
Definition XrdPfcFPurgeState.hh:59
XrdPfc::FPurgeState::getMinTime
time_t getMinTime() const
Definition XrdPfcFPurgeState.hh:62
XrdPfc::FPurgeState::map_i
map_t::iterator map_i
Definition XrdPfcFPurgeState.hh:39
XrdPfc::FPurgeState::CheckFile
void CheckFile(const FsTraversal &fst, const char *fname, time_t atime, struct stat &fstat)
Definition XrdPfcFPurgeState.cc:53
XrdPfc::FPurgeState::ProcessDirAndRecurse
void ProcessDirAndRecurse(FsTraversal &fst)
Definition XrdPfcFPurgeState.cc:85
XrdPfc::FPurgeState::refMap
map_t & refMap()
Definition XrdPfcFPurgeState.hh:58
XrdPfc::FPurgeState::setUVKeepMinTime
void setUVKeepMinTime(time_t min_time)
Definition XrdPfcFPurgeState.hh:63
XrdPfc::FPurgeState::list_t
std::list< PurgeCandidate > list_t
Definition XrdPfcFPurgeState.hh:36
XrdPfc::FPurgeState::map_t
std::multimap< time_t, PurgeCandidate > map_t
Definition XrdPfcFPurgeState.hh:38
XrdPfc::FPurgeState::FPurgeState
FPurgeState(long long iNBytesReq, XrdOss &oss)
Constructor.
Definition XrdPfcFPurgeState.cc:24
XrdPfc::FPurgeState::setMinTime
void setMinTime(time_t min_time)
Definition XrdPfcFPurgeState.hh:61
XrdPfc::FPurgeState::TraverseNamespace
bool TraverseNamespace(const char *root_path)
Definition XrdPfcFPurgeState.cc:119
XrdPfc::FPurgeState::getNBytesTotal
long long getNBytesTotal() const
Definition XrdPfcFPurgeState.hh:65
XrdPfc::FPurgeState::MoveListEntriesToMap
void MoveListEntriesToMap()
Definition XrdPfcFPurgeState.cc:36
XrdPfc::FPurgeState::list_i
list_t::iterator list_i
Definition XrdPfcFPurgeState.hh:37
XrdPfc::FsTraversal
Definition XrdPfcFsTraversal.hh:21
XrdPfc::Info
Status of cached file. Can be read from and written into a binary file.
Definition XrdPfcInfo.hh:41
XrdPfc
Definition XrdPfc.hh:41
XrdPfc::FPurgeState::PurgeCandidate::PurgeCandidate
PurgeCandidate(const std::string &dname, const char *fname, long long n, time_t t)
Definition XrdPfcFPurgeState.hh:31
XrdPfc::FPurgeState::PurgeCandidate::path
std::string path
Definition XrdPfcFPurgeState.hh:27
XrdPfc::FPurgeState::PurgeCandidate::nStBlocks
long long nStBlocks
Definition XrdPfcFPurgeState.hh:28
XrdPfc::FPurgeState::PurgeCandidate::time
time_t time
Definition XrdPfcFPurgeState.hh:29