XRootD
Loading...
Searching...
No Matches
XrdFrmTSort Class Reference

#include <XrdFrmTSort.hh>

+ Collaboration diagram for XrdFrmTSort:

Public Member Functions

 XrdFrmTSort (int szSort=0)
 
 ~XrdFrmTSort ()
 
int Add (XrdFrmFileset *fsp)
 
int Count ()
 
XrdFrmFilesetOldest ()
 
void Purge ()
 

Detailed Description

Definition at line 35 of file XrdFrmTSort.hh.

Constructor & Destructor Documentation

◆ XrdFrmTSort()

XrdFrmTSort::XrdFrmTSort ( int  szSort = 0)
inline

Definition at line 47 of file XrdFrmTSort.hh.

47: sortSZ(szSort) {Reset();}

◆ ~XrdFrmTSort()

XrdFrmTSort::~XrdFrmTSort ( )
inline

Definition at line 48 of file XrdFrmTSort.hh.

48{Purge();}

References Purge().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add()

int XrdFrmTSort::Add ( XrdFrmFileset fsp)

Definition at line 39 of file XrdFrmTSort.cc.

40{
41 XrdOucNSWalk::NSEnt *nsp = fsp->baseFile();
42 int n;
43
44// Make sure we can actuall add this entry
45//
46 if (baseT < nsp->Stat.st_atime) return 0;
47
48// Get the relative time
49//
50 fsp->Age = static_cast<int>(baseT - nsp->Stat.st_atime);
51
52// Insert into the table
53//
54 n = fsp->Age/dVal;
55 if (n > 63) n = 63;
56 fsp->Next = FSTab[0][n];
57 FSTab[0][n] = fsp;
58 if (n > DYent) DYent = n;
59//std::cerr <<"Add " <<std::hex <<fsp->Age <<' ' <<std::dec <<0 <<',' <<n <<' ' <<fsp->basePath() <<std::endl;
60 numEnt++;
61 return 1;
62}
struct stat Stat
Definition XrdCks.cc:49
XrdOucNSWalk::NSEnt * baseFile()
XrdFrmFileset * Next

References XrdFrmFileset::Age, XrdFrmFileset::baseFile(), XrdFrmFileset::Next, Stat, and XrdOucNSWalk::NSEnt::Stat.

+ Here is the call graph for this function:

◆ Count()

int XrdFrmTSort::Count ( )
inline

Definition at line 41 of file XrdFrmTSort.hh.

41{return numEnt;}

◆ Oldest()

XrdFrmFileset * XrdFrmTSort::Oldest ( )

Definition at line 113 of file XrdFrmTSort.cc.

114{
115 XrdFrmFileset *fsp = 0;
116
117// Work backwards on the list, resorting as needed
118//
119 do {while(SCent >= 0)
120 {if ((fsp = FSTab[3][SCent]))
121 {if (!( FSTab[3][SCent] = fsp->Next)) SCent--;
122 numEnt--;
123//std::cerr <<"Oldest " <<fsp->Age <<' ' <<fsp->basePath() <<std::endl;
124 return fsp;
125 } else SCent--;
126 }
127//std::cerr <<"SC=" <<SCent <<" MN=" <<MNent <<" HR=" <<HRent <<" DY=" <<DYent <<std::endl;
128 fsp = 0;
129 while(MNent >= 0 && !fsp) fsp = FSTab[2][MNent--];
130 if (fsp) {FSTab[2][MNent+1]=0; SCent = Bin(fsp, 3, SCshift); continue;}
131 while(HRent >= 0 && !fsp) fsp = FSTab[1][HRent--];
132 if (fsp) {FSTab[1][HRent+1]=0; MNent = Bin(fsp, 2, MNshift); continue;}
133 while(DYent >= 0 && !fsp) fsp = FSTab[0][DYent--];
134 if (fsp) {FSTab[0][DYent+1]=0; HRent = Bin(fsp, 1, HRshift); continue;}
135 } while(numEnt);
136 return 0;
137}

References XrdFrmFileset::Next.

◆ Purge()

void XrdFrmTSort::Purge ( )

Definition at line 143 of file XrdFrmTSort.cc.

144{
145 XrdFrmFileset *fsp, *csp;
146 int i, j, aBeg[4] = {DYent, HRent, MNent, SCent};
147
148 for (i = 0; i < 4; i++)
149 for (j = aBeg[i]; j >= 0; j--)
150 {if ((fsp = FSTab[i][j]))
151 while((csp = fsp)) {fsp = fsp->Next; delete csp;}
152 }
153 Reset();
154}

References XrdFrmFileset::Next.

Referenced by ~XrdFrmTSort().

+ Here is the caller graph for this function:

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