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