xrootd
Loading...
Searching...
No Matches
XrdXrootdPrepare.hh
Go to the documentation of this file.
1#ifndef __XROOTD_PREPARE__H
2#define __XROOTD_PREPARE__H
3/******************************************************************************/
4/* */
5/* X r d X r o o t d P r e p a r e . h h */
6/* */
7/* (c) 2004 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 <dirent.h>
34#include <sys/types.h>
35
36#include "Xrd/XrdJob.hh"
37#include "Xrd/XrdScheduler.hh"
38#include "XrdSys/XrdSysError.hh"
39#include "XrdOuc/XrdOucTList.hh"
40
41/******************************************************************************/
42/* X r d O l b P r e p A r g s */
43/******************************************************************************/
44
46{
47public:
48friend class XrdXrootdPrepare;
49
50char *reqid;
51char *user;
52char *notify;
53int prty;
54char mode[4];
56
57 XrdXrootdPrepArgs(int sfree=1, int pfree=1)
58 {reqid = user = notify = 0; paths = 0; *mode = '\0';
59 dirP = 0; prty = reqlen = usrlen = 0;
60 freestore = sfree; freepaths = pfree;
61 }
63 {XrdOucTList *tp;
64 if (freestore)
65 {if (reqid) free(reqid);
66 if (notify) free(notify);
67 }
68 if (freepaths) while((tp=paths)) {paths=paths->next; delete tp;}
69 if (dirP) closedir(dirP);
70 }
71private:
72DIR *dirP;
77};
78
79/******************************************************************************/
80/* C l a s s X r d O l b P r e p a r e */
81/******************************************************************************/
82
84{
85public:
86
87static int Close(int fd) {return close(fd);}
88
89 void DoIt() {Scrub();
90 SchedP->Schedule((XrdJob *)this, scrubtime+time(0));
91 }
92
93static int List(XrdXrootdPrepArgs &pargs, char *resp, int resplen);
94
95static void Log(XrdXrootdPrepArgs &pargs);
96
97static void Logdel(char *reqid);
98
99static int Open(const char *reqid, int &fsz);
100
101static void Scrub();
102
103static int setParms(int stime, int skeep);
104
105static int setParms(char *ldir);
106
108 ~XrdXrootdPrepare() {} // Never gets deleted
109
110private:
111
112static const char *TraceID;
113static XrdScheduler *SchedP; // System scheduler
114static XrdSysError *eDest; // Error message handler
115
116static int scrubtime;
117static int scrubkeep;
118static char *LogDir;
119static int LogDirLen;
120};
121#endif
#define close(a)
Definition XrdPosix.hh:43
#define closedir(a)
Definition XrdPosix.hh:45
Definition XrdJob.hh:43
Definition XrdOucTList.hh:42
XrdOucTList * next
Definition XrdOucTList.hh:45
Definition XrdScheduler.hh:46
void Schedule(XrdJob *jp)
Definition XrdSysError.hh:90
Definition XrdXrootdPrepare.hh:46
char * reqid
Definition XrdXrootdPrepare.hh:50
int reqlen
Definition XrdXrootdPrepare.hh:73
int usrlen
Definition XrdXrootdPrepare.hh:74
XrdXrootdPrepArgs(int sfree=1, int pfree=1)
Definition XrdXrootdPrepare.hh:57
char * notify
Definition XrdXrootdPrepare.hh:52
DIR * dirP
Definition XrdXrootdPrepare.hh:72
char mode[4]
Definition XrdXrootdPrepare.hh:54
~XrdXrootdPrepArgs()
Definition XrdXrootdPrepare.hh:62
int prty
Definition XrdXrootdPrepare.hh:53
char * user
Definition XrdXrootdPrepare.hh:51
XrdOucTList * paths
Definition XrdXrootdPrepare.hh:55
int freepaths
Definition XrdXrootdPrepare.hh:76
int freestore
Definition XrdXrootdPrepare.hh:75
Definition XrdXrootdPrepare.hh:84
static int Open(const char *reqid, int &fsz)
static int List(XrdXrootdPrepArgs &pargs, char *resp, int resplen)
static XrdSysError * eDest
Definition XrdXrootdPrepare.hh:114
static int scrubtime
Definition XrdXrootdPrepare.hh:116
static int LogDirLen
Definition XrdXrootdPrepare.hh:119
static const char * TraceID
Definition XrdXrootdPrepare.hh:112
~XrdXrootdPrepare()
Definition XrdXrootdPrepare.hh:108
static void Log(XrdXrootdPrepArgs &pargs)
static void Logdel(char *reqid)
static int setParms(int stime, int skeep)
static int scrubkeep
Definition XrdXrootdPrepare.hh:117
static XrdScheduler * SchedP
Definition XrdXrootdPrepare.hh:113
static int Close(int fd)
Definition XrdXrootdPrepare.hh:87
static char * LogDir
Definition XrdXrootdPrepare.hh:118
static int setParms(char *ldir)
XrdXrootdPrepare(XrdSysError *lp, XrdScheduler *sp, bool nomsg)
static void Scrub()
void DoIt()
Definition XrdXrootdPrepare.hh:89