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 
13 // $Id$
14 
15 #include "XrdSys/XrdSysPthread.hh"
16 
17 class XrdOss;
18 class XrdSysError;
19 
21 {
22 public:
23 
24 struct Request
25 {
26 long long addT; // Time committed to the queue
27 char LFN[1024]; // Logical File Name (null terminated)
28 char User[288]; // User trace identifier
29 char Reserved[24]; // Reserved for future
30 };
31 
32 static const int ReqOffs = 64;
33 static const int ReqSize = sizeof(Request);
34 
35 struct recEnt
36 {
38 int Offset;
39 int Mode;
41  recEnt(struct Request &reqref, int mval, recEnt *nval=0)
42  {Next = nval; Offset = 0; Mode = mval; reqData = reqref;}
43 };
44 
45  int Add(const char *Tident, const char *Lfn);
46 
47  int Commit(const char *Lfn, int Offset);
48 
49  int Del(const char *Lfn, int Offset, int Unlink=0);
50 
51  recEnt *Init(int &Ok);
52 
53 static recEnt *List(XrdSysError *Say, const char *theFN);
54 
55 inline int Num() {return pocIQ;}
56 
57  XrdOfsPoscq(XrdSysError *erp, XrdOss *oss, const char *fn);
59 
60 private:
61 void FailIni(const char *lfn);
62 int reqRead(void *Buff, int Offs);
63 int reqWrite(void *Buff, int Bsz, int Offs);
64 int ReWrite(recEnt *rP);
65 int VerOffset(const char *Lfn, int Offset);
66 
67 struct FileSlot
69  int Offset;
70  };
71 
77 char *pocFN;
78 int pocSZ;
79 int pocFD;
80 int pocIQ;
81 };
82 #endif