Loading...
Searching...
No Matches
XrdFrmPurgeDir Class Reference
Inheritance diagram for XrdFrmPurgeDir:
Collaboration diagram for XrdFrmPurgeDir:

## Public Member Functions

| XrdFrmPurgeDir ()
| ~XrdFrmPurgeDir ()
void | isEmpty (struct stat *dStat, const char *dPath, const char *lkFN)
void | Reset (time_t dExp)

## Public Attributes

time_t | expDirTime
time_t | lowDirTime
int | numEMD
int | numRMD

## Detailed Description

Definition at line 64 of file XrdFrmPurge.cc.

## Constructor & Destructor Documentation

## XrdFrmPurgeDir()

XrdFrmPurgeDir::XrdFrmPurgeDir | ( |  | ) |

inline

Definition at line 78 of file XrdFrmPurge.cc.

{}

## ~XrdFrmPurgeDir()

XrdFrmPurgeDir::~XrdFrmPurgeDir | ( |  | ) |

inline

Definition at line 79 of file XrdFrmPurge.cc.

{}

## Member Function Documentation

## isEmpty()

void XrdFrmPurgeDir::isEmpty | ( | struct stat * | dStat,
|  | const char * | dPath,
|  | const char * | lkFN )

virtual

Implements XrdOucNSWalk::CallBack.

Definition at line 86 of file XrdFrmPurge.cc.

{
static const int ossOpts = XRDOSS_isPFN | XRDOSS_resonly;
static const char *What = (Config.Test ? "Zorch " : "Purged ");
struct stat pStat;
struct utimbuf times;
char Parent[MAXPATHLEN+1], *Slash;
int n, rc;
// Check if this directory is still considered active
//
numEMD++;
if (dStat->st_mtime > expDirTime)
{if (!lowDirTime || lowDirTime > dStat->st_mtime)
lowDirTime = dStat->st_mtime;
return;
}
// We can expire the directory. However, we need to get the parent mtime
// because removing this directory should not change the parent's mtime.
//
strcpy(Parent, dPath);
n = strlen(Parent);
if (Parent[n-1] == '/') Parent[--n] = '\0';
if ((Slash = rindex(Parent, '/')))
{*Slash = '\0';
if (stat(Parent, &pStat)) Slash = 0;
}
// Delete the directory
//
if (Config.Test) rc = 0;
else if (!(rc = Config.ossFS->Remdir(dPath, ossOpts)) && Slash)
{times.actime = pStat.st_atime;
times.modtime = pStat.st_mtime;
utime(Parent, &times);
XrdFrmCns::Rmd(dPath);
}
// Report if successful
//
if (!rc)
{numRMD++;
if (Config.Verbose)
{char sbuff[64];
struct tm tNow;
localtime_r(&(dStat->st_mtime), &tNow);
sprintf(sbuff, "%02d%02d%02d %02d:%02d:%02d ",
tNow.tm_year-100, tNow.tm_mon+1, tNow.tm_mday,
tNow.tm_hour, tNow.tm_min, tNow.tm_sec);
Say.Say(What, "empty dir ", sbuff, dPath);
}
}
}
XRDOSS_isPFN
#define XRDOSS_isPFN
Definition XrdOss.hh:469
XRDOSS_resonly
#define XRDOSS_resonly
Definition XrdOss.hh:486
stat
#define stat(a, b)
Definition XrdPosix.hh:101
XrdFrmCns::Rmd
static void Rmd(const char *Path, int islfn=0)
Definition XrdFrmCns.hh:56
XrdFrmConfig::Verbose
int Verbose
Definition XrdFrmConfig.hh:112
XrdFrmConfig::ossFS
XrdOss * ossFS
Definition XrdFrmConfig.hh:91
XrdFrmConfig::Test
int Test
Definition XrdFrmConfig.hh:110
XrdFrmPurgeDir::numEMD
int numEMD
Definition XrdFrmPurge.cc:76
XrdFrmPurgeDir::expDirTime
time_t expDirTime
Definition XrdFrmPurge.cc:73
XrdFrmPurgeDir::lowDirTime
time_t lowDirTime
Definition XrdFrmPurge.cc:74
XrdFrmPurgeDir::numRMD
int numRMD
Definition XrdFrmPurge.cc:75
XrdOss::Remdir
virtual int Remdir(const char *path, int Opts=0, XrdOucEnv *envP=0)=0
XrdSysError::Say
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition XrdSysError.cc:141
XrdFrc::Say
XrdSysError Say
XrdFrm::Config
XrdFrmConfig Config

References XrdFrm::Config, expDirTime, lowDirTime, numEMD, numRMD, XrdFrmCns::Rmd(), XrdFrc::Say, stat, XRDOSS_isPFN, and XRDOSS_resonly.

Here is the call graph for this function:

## Reset()

void XrdFrmPurgeDir::Reset | ( | time_t | dExp | ) |

inline

Definition at line 70 of file XrdFrmPurge.cc.

{expDirTime = dExp; lowDirTime = 0; numRMD = numEMD = 0;}

References expDirTime, lowDirTime, numEMD, and numRMD.

## Member Data Documentation

## expDirTime

time_t XrdFrmPurgeDir::expDirTime

Definition at line 73 of file XrdFrmPurge.cc.

Referenced by isEmpty(), and Reset().

## lowDirTime

time_t XrdFrmPurgeDir::lowDirTime

Definition at line 74 of file XrdFrmPurge.cc.

Referenced by isEmpty(), and Reset().

## numEMD

int XrdFrmPurgeDir::numEMD

Definition at line 76 of file XrdFrmPurge.cc.

Referenced by isEmpty(), and Reset().

## numRMD

int XrdFrmPurgeDir::numRMD

Definition at line 75 of file XrdFrmPurge.cc.

Referenced by isEmpty(), and Reset().

The documentation for this class was generated from the following file:

- XrdFrmPurge.cc