• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XrdFrmPstgReq.hh

Go to the documentation of this file.
00001 #ifndef __FRMPSTGREQ_H__
00002 #define __FRMPSTGREQ_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                      X r d F r m P s t g R e q . h h                       */
00006 /*                                                                            */
00007 /* (c) 2009 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: XrdFrmPstgReq.hh,v 1.1 2009/01/14 03:35:19 abh Exp $
00014 
00015 class XrdFrmPstgReq
00016 {
00017 public:
00018 
00019 struct Request
00020 {
00021 char      LFN[2176];    // Logical File Name (optional '\0' opaque)
00022 char      User[256];    // User trace identifier
00023 char      ID[64];       // Request ID
00024 char      Notify[512];  // Notification path
00025 char      Reserved[40]; // Reserved for future
00026 long long addTOD;       // Time added to queue
00027 int       This;         // Offset to this request
00028 int       Next;         // Offset to next request
00029 int       Opaque;       // Offset to '?' in LFN if exists, 0 o/w
00030 short     Options;      // Processing options (see class definitions)
00031 short     Prty;         // Request priority
00032 };
00033 
00034 static const int msgFail  = 0x0001;
00035 static const int msgSucc  = 0x0002;
00036 static const int stgRW    = 0x0004;
00037 
00038 static const int maxPrty  = 2;
00039 
00040 static const int ReqSize  = sizeof(Request);
00041 
00042        void   Add(Request *rP);
00043 
00044        void   Can(Request *rP);
00045 
00046        void   Del(Request *rP);
00047 
00048        int    Get(Request *rP);
00049 
00050        int    Init();
00051 
00052 enum Item {getLFN=0, getLFNCGI, getMODE, getNOTE, getPRTY, getQWT,
00053            getRID,   getTOD,    getUSER};
00054 
00055        char  *List(char *Buff, int bsz, int &Offs, Item *ITList=0, int ITNum=0);
00056 
00057        void   ListL(XrdFrmPstgReq::Request tmpReq, char *Buff, int bsz,
00058                     Item *ITList, int ITNum);
00059 
00060 static int    Unique(const char *lkfn);
00061 
00062               XrdFrmPstgReq(const char *fn);
00063              ~XrdFrmPstgReq() {}
00064 
00065 private:
00066 enum LockType {lkNone, lkShare, lkExcl, lkInit};
00067 
00068 void   FailAdd(char *lfn, int unlk=1);
00069 void   FailCan(char *rid, int unlk=1);
00070 void   FailDel(char *lfn, int unlk=1);
00071 int    FailIni(const char *lfn);
00072 int    FileLock(LockType ltype=lkExcl);
00073 int    reqRead(void *Buff, int Offs);
00074 int    reqWrite(void *Buff, int Offs, int updthdr=1);
00075 
00076 struct FileHdr
00077 {
00078 int    First;
00079 int    Last;
00080 int    Free;
00081 }      HdrData;
00082 
00083 char  *lokFN;
00084 int    lokFD;
00085 int    reqFD;
00086 char  *reqFN;
00087 
00088 struct recEnt {recEnt *Next;
00089                struct Request reqData;
00090                recEnt(struct Request &reqref) {Next = 0; reqData = reqref;}
00091               };
00092 int    ReWrite(recEnt *rP);
00093 };
00094 namespace XrdFrm
00095 {
00096 extern XrdFrmPstgReq     *rQueue[XrdFrmPstgReq::maxPrty];
00097 }
00098 #endif

Generated on Wed Sep 1 2010 for xrootd by  doxygen 1.7.1