xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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;
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
91  int Offset;
92  };
93 
94 std::map<std::string, int> pqMap;
95 
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
FileSlot * SlotLust
Definition: XrdOfsPoscq.hh:100
int Num()
Definition: XrdOfsPoscq.hh:76
char User[288]
Definition: XrdOfsPoscq.hh:49
int Add(const char *Tident, const char *Lfn, bool isNew)
int pocSZ
Definition: XrdOfsPoscq.hh:102
char * pocFN
Definition: XrdOfsPoscq.hh:101
int Offset
Definition: XrdOfsPoscq.hh:59
Definition: XrdOfsPoscq.hh:41
FileSlot * SlotList
Definition: XrdOfsPoscq.hh:99
static recEnt * List(XrdSysError *Say, const char *theFN)
std::map< std::string, int > pqMap
Definition: XrdOfsPoscq.hh:94
char LFN[1024]
Definition: XrdOfsPoscq.hh:48
XrdSysError Say
XrdSysMutex myMutex
Definition: XrdOfsPoscq.hh:96
Definition: XrdOfsPoscq.hh:89
static const int ReqSize
Definition: XrdOfsPoscq.hh:54
~XrdOfsPoscq()
Definition: XrdOfsPoscq.hh:80
bool VerOffset(const char *Lfn, int Offset)
recEnt * Init(int &Ok)
int pocIQ
Definition: XrdOfsPoscq.hh:104
static const int ReqOffs
Definition: XrdOfsPoscq.hh:53
void FailIni(const char *lfn)
int Del(const char *Lfn, int Offset, int Unlink=0)
Definition: XrdSysError.hh:89
XrdSysError * eDest
Definition: XrdOfsPoscq.hh:97
XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn, int sv=1)
Definition: XrdOfsPoscq.hh:56
long long addT
Definition: XrdOfsPoscq.hh:47
Definition: XrdSysPthread.hh:164
bool reqWrite(void *Buff, int Bsz, int Offs)
bool ReWrite(recEnt *rP)
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:62
XrdOss * ossFS
Definition: XrdOfsPoscq.hh:98
FileSlot * Next
Definition: XrdOfsPoscq.hh:90
int Mode
Definition: XrdOfsPoscq.hh:60
Definition: XrdOss.hh:497
int Commit(const char *Lfn, int Offset)
struct Request reqData
Definition: XrdOfsPoscq.hh:61
recEnt * Next
Definition: XrdOfsPoscq.hh:58
int pocFD
Definition: XrdOfsPoscq.hh:103
int Offset
Definition: XrdOfsPoscq.hh:91
Definition: XrdOfsPoscq.hh:45
unsigned short pocWS
Definition: XrdOfsPoscq.hh:106
unsigned short pocSV
Definition: XrdOfsPoscq.hh:108
char Reserved[24]
Definition: XrdOfsPoscq.hh:50