Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

XrdCmsCache.hh

Go to the documentation of this file.
00001 #ifndef __CMS_CACHE__H
00002 #define __CMS_CACHE__H
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d C m s C a c h e . h h                         */
00006 /*                                                                            */
00007 /* (c) 2007 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 
00013 #include <string.h>
00014   
00015 #include "Xrd/XrdJob.hh"
00016 #include "Xrd/XrdScheduler.hh"
00017 #include "XrdCms/XrdCmsKey.hh"
00018 #include "XrdCms/XrdCmsNash.hh"
00019 #include "XrdCms/XrdCmsPList.hh"
00020 #include "XrdSys/XrdSysPthread.hh"
00021 #include "XrdCms/XrdCmsSelect.hh"
00022 #include "XrdCms/XrdCmsTypes.hh"
00023   
00024 class XrdCmsCache
00025 {
00026 public:
00027 friend class XrdCmsCacheJob;
00028 
00029 XrdCmsPList_Anchor Paths;
00030 
00031 // AddFile() returns true if this is the first addition, false otherwise. See
00032 //           method for detailed information on processing.
00033 //
00034 int         AddFile(XrdCmsSelect &Sel, SMask_t mask);
00035 
00036 // DelFile() returns true if this is the last deletion, false otherwise
00037 //
00038 int         DelFile(XrdCmsSelect &Sel, SMask_t mask);
00039 
00040 // GetFile() returns true if we actually found the file
00041 //
00042 int         GetFile(XrdCmsSelect &Sel, SMask_t mask);
00043 
00044 // UnkFile() updates the unqueried vector and returns 1 upon success, 0 o/w.
00045 //
00046 int         UnkFile(XrdCmsSelect &Sel, SMask_t mask);
00047 
00048 // WT4File() adds a request to the callback queue and returns a 0 if added
00049 //           of a wait time to be returned to the client.
00050 //
00051 int         WT4File(XrdCmsSelect &Sel, SMask_t mask);
00052 
00053 void        Bounce(SMask_t smask, int SNum);
00054 
00055 void        Drop(SMask_t mask, int SNum, int xHi);
00056 
00057 int         Init(int fxHold, int fxDelay, int fxQuery, int seFS);
00058 
00059 void       *TickTock();
00060 
00061             XrdCmsCache() : okVec(0), Tick(8*60*60), Tock(0), BClock(0), 
00062                             DLTime(5), Bhits(0), Bmiss(0), vecHi(-1), isDFS(0)
00063                           {memset(Bounced,  0, sizeof(Bounced));
00064                            memset(Bhistory, 0, sizeof(Bhistory));
00065                           }
00066            ~XrdCmsCache() {}   // Never gets deleted
00067 
00068 private:
00069 
00070 void          Add2Q(XrdCmsRRQInfo *Info, XrdCmsKeyItem *cp, int isrw);
00071 void          Dispatch(XrdCmsSelect &Sel, XrdCmsKeyItem *cinfo,
00072                        short roQ, short rwQ);
00073 SMask_t       getBVec(unsigned int todA, unsigned int &todB);
00074 void          Recycle(XrdCmsKeyItem *theList);
00075 
00076 struct  {SMask_t      Vec;
00077          unsigned int Start;
00078          unsigned int End;
00079         }             Bhistory[XrdCmsKeyItem::TickRate];
00080 
00081 XrdSysMutex   myMutex;
00082 XrdCmsNash    CTable;
00083 unsigned int  Bounced[STMax];
00084 SMask_t       okVec;
00085 unsigned int  Tick;
00086 unsigned int  Tock;
00087 unsigned int  BClock;
00088          int  DLTime;
00089          int  QDelay;
00090          int  Bhits;
00091          int  Bmiss;
00092          int  vecHi;
00093          int  isDFS;
00094 };
00095 
00096 namespace XrdCms
00097 {
00098 extern    XrdCmsCache Cache;
00099 }
00100 #endif

Generated on Sun Nov 6 13:35:16 2011 for xrootd by  doxygen 1.3.9.1