|
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 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include "XrdSys/XrdSysPthread.hh" 00034 00035 class XrdOss; 00036 class XrdSysError; 00037 00038 class XrdOfsPoscq 00039 { 00040 public: 00041 00042 struct Request 00043 { 00044 long long addT; // Time committed to the queue 00045 char LFN[1024]; // Logical File Name (null terminated) 00046 char User[288]; // User trace identifier 00047 char Reserved[24]; // Reserved for future 00048 }; 00049 00050 static const int ReqOffs = 64; 00051 static const int ReqSize = sizeof(Request); 00052 00053 struct recEnt 00054 { 00055 recEnt *Next; 00056 int Offset; 00057 int Mode; 00058 struct Request reqData; 00059 recEnt(struct Request &reqref, int mval, recEnt *nval=0) 00060 {Next = nval; Offset = 0; Mode = mval; reqData = reqref;} 00061 }; 00062 00063 int Add(const char *Tident, const char *Lfn); 00064 00065 int Commit(const char *Lfn, int Offset); 00066 00067 int Del(const char *Lfn, int Offset, int Unlink=0); 00068 00069 recEnt *Init(int &Ok); 00070 00071 static recEnt *List(XrdSysError *Say, const char *theFN); 00072 00073 inline int Num() {return pocIQ;} 00074 00075 XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn); 00076 ~XrdOfsPoscq() {} 00077 00078 private: 00079 void FailIni(const char *lfn); 00080 int reqRead(void *Buff, int Offs); 00081 int reqWrite(void *Buff, int Bsz, int Offs); 00082 int ReWrite(recEnt *rP); 00083 int VerOffset(const char *Lfn, int Offset); 00084 00085 struct FileSlot 00086 {FileSlot *Next; 00087 int Offset; 00088 }; 00089 00090 XrdSysMutex myMutex; 00091 XrdSysError *eDest; 00092 XrdOss *ossFS; 00093 FileSlot *SlotList; 00094 FileSlot *SlotLust; 00095 char *pocFN; 00096 int pocSZ; 00097 int pocFD; 00098 int pocIQ; 00099 }; 00100 #endif
1.7.6.1