XrdFrmReqFile.hh

Go to the documentation of this file.
00001 #ifndef __FRMREQFILE_H__
00002 #define __FRMREQFILE_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                      X r d F r m R e q F i l e . h h                       */
00006 /*                                                                            */
00007 /* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 //          $Id: XrdFrmReqFile.hh 35287 2010-09-14 21:19:35Z ganis $
00014 
00015 #include "XrdFrm/XrdFrmRequest.hh"
00016 #include "XrdSys/XrdSysPthread.hh"
00017 
00018 class XrdFrmReqFile
00019 {
00020 public:
00021 
00022        void   Add(XrdFrmRequest *rP);
00023 
00024        void   Can(XrdFrmRequest *rP);
00025 
00026        void   Del(XrdFrmRequest *rP);
00027 
00028        int    Get(XrdFrmRequest *rP);
00029 
00030        int    Init();
00031 
00032        char  *List(char *Buff, int bsz, int &Offs,
00033                     XrdFrmRequest::Item *ITList=0, int ITNum=0);
00034 
00035        void   ListL(XrdFrmRequest &tmpReq, char *Buff, int bsz,
00036                     XrdFrmRequest::Item *ITList, int ITNum);
00037 
00038               XrdFrmReqFile(const char *fn, int aVal);
00039              ~XrdFrmReqFile() {}
00040 
00041 private:
00042 enum LockType {lkNone, lkShare, lkExcl, lkInit};
00043 
00044 static const int ReqSize  = sizeof(XrdFrmRequest);
00045 
00046 void   FailAdd(char *lfn, int unlk=1);
00047 void   FailCan(char *rid, int unlk=1);
00048 void   FailDel(char *lfn, int unlk=1);
00049 int    FailIni(const char *lfn);
00050 int    FileLock(LockType ltype=lkExcl);
00051 int    reqRead(void *Buff, int Offs);
00052 int    reqWrite(void *Buff, int Offs, int updthdr=1);
00053 
00054 struct FileHdr
00055 {
00056 int    First;
00057 int    Last;
00058 int    Free;
00059 }      HdrData;
00060 
00061 char  *lokFN;
00062 int    lokFD;
00063 int    reqFD;
00064 char  *reqFN;
00065 
00066 int    isAgent;
00067 
00068 struct recEnt {recEnt       *Next;
00069                XrdFrmRequest reqData;
00070                recEnt(XrdFrmRequest &reqref) {Next = 0; reqData = reqref;}
00071               };
00072 int    ReWrite(recEnt *rP);
00073 
00074 class rqMonitor
00075 {
00076 public:
00077       rqMonitor(int isAgent) : doUL(isAgent)
00078                   {if (isAgent) rqMutex.Lock();}
00079      ~rqMonitor() {if (doUL)    rqMutex.UnLock();}
00080 private:
00081 static XrdSysMutex rqMutex;
00082 int                doUL;
00083 };
00084 };
00085 #endif

Generated on Tue Jul 5 14:46:36 2011 for ROOT_528-00b_version by  doxygen 1.5.1