xrootd
|
00001 #ifndef __OFSPOSCQ_H__ 00002 #define __OFSPOSCQ_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O f s P o s c 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$ 00014 00015 #include "XrdSys/XrdSysPthread.hh" 00016 00017 class XrdOss; 00018 class XrdSysError; 00019 00020 class XrdOfsPoscq 00021 { 00022 public: 00023 00024 struct Request 00025 { 00026 long long addT; // Time committed to the queue 00027 char LFN[1024]; // Logical File Name (null terminated) 00028 char User[288]; // User trace identifier 00029 char Reserved[24]; // Reserved for future 00030 }; 00031 00032 static const int ReqOffs = 64; 00033 static const int ReqSize = sizeof(Request); 00034 00035 struct recEnt 00036 { 00037 recEnt *Next; 00038 int Offset; 00039 int Mode; 00040 struct Request reqData; 00041 recEnt(struct Request &reqref, int mval, recEnt *nval=0) 00042 {Next = nval; Offset = 0; Mode = mval; reqData = reqref;} 00043 }; 00044 00045 int Add(const char *Tident, const char *Lfn); 00046 00047 int Commit(const char *Lfn, int Offset); 00048 00049 int Del(const char *Lfn, int Offset, int Unlink=0); 00050 00051 recEnt *Init(int &Ok); 00052 00053 static recEnt *List(XrdSysError *Say, const char *theFN); 00054 00055 inline int Num() {return pocIQ;} 00056 00057 XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn); 00058 ~XrdOfsPoscq() {} 00059 00060 private: 00061 void FailIni(const char *lfn); 00062 int reqRead(void *Buff, int Offs); 00063 int reqWrite(void *Buff, int Bsz, int Offs); 00064 int ReWrite(recEnt *rP); 00065 int VerOffset(const char *Lfn, int Offset); 00066 00067 struct FileSlot 00068 {FileSlot *Next; 00069 int Offset; 00070 }; 00071 00072 XrdSysMutex myMutex; 00073 XrdSysError *eDest; 00074 XrdOss *ossFS; 00075 FileSlot *SlotList; 00076 FileSlot *SlotLust; 00077 char *pocFN; 00078 int pocSZ; 00079 int pocFD; 00080 int pocIQ; 00081 }; 00082 #endif