xrootd
Loading...
Searching...
No Matches
XrdFrmFiles.hh
Go to the documentation of this file.
1#ifndef __FRMFILES__HH
2#define __FRMFILES__HH
3/******************************************************************************/
4/* */
5/* X r d F r m F i l e s . h h */
6/* */
7/* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cstring>
34#include <sys/types.h>
35
36#include "XrdFrc/XrdFrcXAttr.hh"
37#include "XrdOss/XrdOssPath.hh"
38#include "XrdOuc/XrdOucHash.hh"
40#include "XrdOuc/XrdOucXAttr.hh"
41
42class XrdOucTList;
43
44/******************************************************************************/
45/* C l a s s X r d F r m F i l e s e t */
46/******************************************************************************/
47
49{
50public:
51friend class XrdFrmFiles;
52
53// The following are the extended attributes describing file characteristics
54//
57
58// These are inline function to return most common file information
59//
61const char *basePath() {return Mkfn(baseFile());}
63const char *failPath() {return Mkfn(failFile());}
65const char *lockPath() {return Mkfn(lockFile());}
67const char * pfnPath() {return Mkfn(pfnFile());}
69const char * pinPath() {return Mkfn(pinFile());}
70
72const char * xyzPath(XrdOssPath::theSfx sfx)
73 {return Mkfn(File[sfx]);}
74
75int dirPath(char *dBuff, int dBlen);
76
77static void Purge() {BadFiles.Purge();}
78
79int Refresh(int isMig=0, int doLock=1);
80
81int Screen(int needLF=1);
82
84
87
88// The following are public to ease management of this object
89//
91int Age;
92
93private:
94int chkLock(const char *Path);
95const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
96void Remfix(const char *fType, const char *fPath);
97
98// These are the basic set of files related to the base file. Two other file
99// suffixes are ignore for fileset purposes (".anew" and ".stage").
100//
102
103XrdOucTList *dInfo; // Shared directory information
104
106
107static const int dLen = 0; // Index to directory path length in dInfo
108static const int dRef = 1; // Index to the reference counter in dInfo
109};
110
111/******************************************************************************/
112/* C l a s s X r d F r m F i l e s */
113/******************************************************************************/
114
116{
117public:
118
119XrdFrmFileset *Get(int &rc, int noBase=0);
120
121static const int Recursive = 0x0001; // List filesets recursively
122static const int CompressD = 0x0002; // Use shared directory object (not MT)
123static const int NoAutoDel = 0x0004; // Do not automatically delete objects
124static const int GetCpyTim = 0x0008; // Initialize cpyInfo attribute on Get()
125
126 XrdFrmFiles(const char *dname, int opts=Recursive,
127 XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
128
130
131private:
132void Complain(const char *dPath);
133int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType);
134int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
135
137
143};
144#endif
XrdOucHash_Options
Definition XrdOucHash.hh:51
Definition XrdFrmFiles.hh:116
XrdOucNSWalk nsObj
Definition XrdFrmFiles.hh:138
int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType)
static const int CompressD
Definition XrdFrmFiles.hh:122
static const int NoAutoDel
Definition XrdFrmFiles.hh:123
XrdOucHash_Options manMem
Definition XrdFrmFiles.hh:140
XrdFrmFiles(const char *dname, int opts=Recursive, XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0)
void Complain(const char *dPath)
static const int GetCpyTim
Definition XrdFrmFiles.hh:124
XrdFrmFileset * Get(int &rc, int noBase=0)
int shareD
Definition XrdFrmFiles.hh:141
XrdOucHash< XrdFrmFileset > fsTab
Definition XrdFrmFiles.hh:136
int getCPT
Definition XrdFrmFiles.hh:142
static const int Recursive
Definition XrdFrmFiles.hh:121
XrdFrmFileset * fsList
Definition XrdFrmFiles.hh:139
int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath)
Definition XrdFrmFiles.hh:49
const char * pinPath()
Definition XrdFrmFiles.hh:69
int setCpyTime(int Refresh=0)
int Refresh(int isMig=0, int doLock=1)
const char * basePath()
Definition XrdFrmFiles.hh:61
const char * pfnPath()
Definition XrdFrmFiles.hh:67
XrdOucNSWalk::NSEnt * baseFile()
Definition XrdFrmFiles.hh:60
const char * lockPath()
Definition XrdFrmFiles.hh:65
XrdOucXAttr< XrdFrcXAttrCpy > cpyInfo
Definition XrdFrmFiles.hh:55
XrdOucNSWalk::NSEnt * lockFile()
Definition XrdFrmFiles.hh:64
void Remfix(const char *fType, const char *fPath)
int chkLock(const char *Path)
int Screen(int needLF=1)
int dirPath(char *dBuff, int dBlen)
XrdOucXAttr< XrdFrcXAttrPin > pinInfo
Definition XrdFrmFiles.hh:56
XrdOucNSWalk::NSEnt * pinFile()
Definition XrdFrmFiles.hh:68
static const int dLen
Definition XrdFrmFiles.hh:107
XrdFrmFileset * Next
Definition XrdFrmFiles.hh:90
int Age
Definition XrdFrmFiles.hh:91
XrdOucNSWalk::NSEnt * xyzFile(XrdOssPath::theSfx sfx)
Definition XrdFrmFiles.hh:71
static XrdOucHash< char > BadFiles
Definition XrdFrmFiles.hh:105
XrdOucTList * dInfo
Definition XrdFrmFiles.hh:103
const char * failPath()
Definition XrdFrmFiles.hh:63
XrdOucNSWalk::NSEnt * File[XrdOssPath::sfxNum]
Definition XrdFrmFiles.hh:101
const char * Mkfn(XrdOucNSWalk::NSEnt *fP)
XrdOucNSWalk::NSEnt * pfnFile()
Definition XrdFrmFiles.hh:66
const char * xyzPath(XrdOssPath::theSfx sfx)
Definition XrdFrmFiles.hh:72
static void Purge()
Definition XrdFrmFiles.hh:77
static const int dRef
Definition XrdFrmFiles.hh:108
XrdFrmFileset(XrdFrmFileset *sP=0, XrdOucTList *diP=0)
XrdOucNSWalk::NSEnt * failFile()
Definition XrdFrmFiles.hh:62
theSfx
Definition XrdOssPath.hh:68
@ isFail
Definition XrdOssPath.hh:69
@ isPin
Definition XrdOssPath.hh:69
@ isBase
Definition XrdOssPath.hh:68
@ isLock
Definition XrdOssPath.hh:69
@ sfxNum
Definition XrdOssPath.hh:71
@ isPfn
Definition XrdOssPath.hh:71
Definition XrdOucHash.hh:128
void Purge()
Definition XrdOucNSWalk.hh:88
Definition XrdOucNSWalk.hh:43
Definition XrdOucTList.hh:42
Definition XrdOucXAttr.hh:109
Definition XrdOucNSWalk.hh:47