XRootD
XrdOfsPoscq.hh
Go to the documentation of this file.
1 #ifndef __OFSPOSCQ_H__
2 #define __OFSPOSCQ_H__
3 /******************************************************************************/
4 /* */
5 /* X r d O f s P o s c q . h h */
6 /* */
7 /* (c) 2009 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 <map>
34 #include <string>
35 
36 #include "XrdSys/XrdSysPthread.hh"
37 
38 class XrdOss;
39 class XrdSysError;
40 
42 {
43 public:
44 
45 struct Request
46 {
47 long long addT; // Time committed to the queue
48 char LFN[1024]; // Logical File Name (null terminated)
49 char User[288]; // User trace identifier
50 char Reserved[24]; // Reserved for future
51 };
52 
53 static const int ReqOffs = 64;
54 static const int ReqSize = sizeof(Request);
55 
56 struct recEnt
57 {
59 int Offset;
60 int Mode;
61 struct Request reqData;
62  recEnt(struct Request &reqref, int mval, recEnt *nval=0)
63  {Next = nval; Offset = 0; Mode = mval; reqData = reqref;}
64 };
65 
66  int Add(const char *Tident, const char *Lfn, bool isNew);
67 
68  int Commit(const char *Lfn, int Offset);
69 
70  int Del(const char *Lfn, int Offset, int Unlink=0);
71 
72  recEnt *Init(int &Ok);
73 
74 static recEnt *List(XrdSysError *Say, const char *theFN);
75 
76 inline int Num() {return pocIQ;}
77 
78  XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn,
79  int sv=1);
81 
82 private:
83 void FailIni(const char *lfn);
84 //int reqRead(void *Buff, int Offs);
85 bool reqWrite(void *Buff, int Bsz, int Offs);
86 bool ReWrite(recEnt *rP);
87 bool VerOffset(const char *Lfn, int Offset);
88 
89 struct FileSlot
90  {FileSlot *Next;
91  int Offset;
92  };
93 
94 std::map<std::string, int> pqMap;
95 
96 XrdSysMutex myMutex;
97 XrdSysError *eDest;
98 XrdOss *ossFS;
99 FileSlot *SlotList;
100 FileSlot *SlotLust;
101 char *pocFN;
102 int pocSZ;
103 int pocFD;
104 int pocIQ;
105 unsigned
106 short pocWS;
107 unsigned
108 short pocSV;
109 };
110 #endif
static const int ReqOffs
Definition: XrdOfsPoscq.hh:53
int Del(const char *Lfn, int Offset, int Unlink=0)
Definition: XrdOfsPoscq.cc:159
static recEnt * List(XrdSysError *Say, const char *theFN)
Definition: XrdOfsPoscq.cc:264
XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn, int sv=1)
Definition: XrdOfsPoscq.cc:53
recEnt * Init(int &Ok)
Definition: XrdOfsPoscq.cc:207
static const int ReqSize
Definition: XrdOfsPoscq.hh:54
int Commit(const char *Lfn, int Offset)
Definition: XrdOfsPoscq.cc:132
int Add(const char *Tident, const char *Lfn, bool isNew)
Definition: XrdOfsPoscq.cc:72
XRootDStatus Unlink(Davix::DavPosix &davix_client, const std::string &url, uint16_t timeout)
XrdSysError Say
recEnt(struct Request &reqref, int mval, recEnt *nval=0)
Definition: XrdOfsPoscq.hh:62
struct Request reqData
Definition: XrdOfsPoscq.hh:61