• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XrdOlbRRQ.hh

Go to the documentation of this file.
00001 #ifndef __XRDOLBRRQ_HH__
00002 #define __XRDOLBRRQ_HH__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                          X r d O l b R R Q . h h                           */
00006 /*                                                                            */
00007 /* (c) 2006 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 //         $Id: XrdOlbRRQ.hh,v 1.6 2007/11/03 00:19:04 abh Exp $
00014 
00015 #include <sys/uio.h>
00016 
00017 #include "XrdOlb/XrdOlbTypes.hh"
00018 #include "XrdOuc/XrdOucDLlist.hh"
00019 #include "XrdSys/XrdSysPthread.hh"
00020   
00021 /******************************************************************************/
00022 /*                         X r d O l b R R Q I n f o                          */
00023 /******************************************************************************/
00024   
00025 class XrdOlbRRQInfo
00026 {
00027 public:
00028 void   *Key;     // Key link, which is the cache line address
00029 int     Rinst;   // Redirector instance
00030 short   Rnum;    // Redirector number (RTable slot number)
00031 char    isRW;    // True if r/w access wanted
00032 char    isLU;    // True if this is a lookup only
00033 char    ID[16];  // Response link, which is the request ID
00034 SMask_t Arg;     // Argument to lookup
00035 
00036         XrdOlbRRQInfo() {isLU = 0;}
00037        ~XrdOlbRRQInfo() {}
00038 };
00039 
00040 /******************************************************************************/
00041 /*                         X r d O l b R R Q S l o t                          */
00042 /******************************************************************************/
00043   
00044 class XrdOlbRRQSlot
00045 {
00046 friend class XrdOlbRRQ;
00047 
00048 static XrdOlbRRQSlot *Alloc(XrdOlbRRQInfo *Info);
00049 
00050        void           Recycle();
00051 
00052        XrdOlbRRQSlot();
00053       ~XrdOlbRRQSlot() {}
00054 
00055 private:
00056 
00057 static   XrdSysMutex                 myMutex;
00058 static   XrdOlbRRQSlot              *freeSlot;
00059 static   short                       initSlot;
00060 
00061          XrdOucDLlist<XrdOlbRRQSlot> Link;
00062          XrdOlbRRQSlot              *Cont;
00063          XrdOlbRRQInfo               Info;
00064          SMask_t                     Arg;
00065 unsigned int                         Expire;
00066          int                         slotNum;
00067 };
00068 
00069 /******************************************************************************/
00070 /*                             X r d O l b R R Q                              */
00071 /******************************************************************************/
00072   
00073 class XrdOlbRRQ
00074 {
00075 public:
00076 
00077 short Add(short Snum, XrdOlbRRQInfo *ip);
00078 
00079 void  Del(short Snum, const void *Key);
00080 
00081 int   Init(int Tint=0, int Tdly=0);
00082 
00083 void  Ready(int Snum, const void *Key, SMask_t mask);
00084 
00085 void *Respond();
00086 
00087 void *TimeOut();
00088 
00089       XrdOlbRRQ() : isWaiting(0), isReady(0), Tslice(133),
00090                     Tdelay(5),    myClock(0) {}
00091      ~XrdOlbRRQ() {}
00092 
00093 private:
00094 
00095 XrdOlbRRQSlot *sendLocInfo(XrdOlbRRQSlot *Sp);
00096 void           sendResponse(XrdOlbRRQInfo *Info, int doredir);
00097 static const int numSlots = 1024;
00098 
00099          XrdSysMutex                 myMutex;
00100          XrdSysSemaphore             isWaiting;
00101          XrdSysSemaphore             isReady;
00102          XrdOlbRRQSlot               Slot[numSlots];
00103          XrdOucDLlist<XrdOlbRRQSlot> waitQ;
00104          XrdOucDLlist<XrdOlbRRQSlot> readyQ;
00105 static   const int                   redr_iov_cnt = 3;
00106 static   const int                   wait_iov_cnt = 2;
00107          struct iovec                redr_iov[redr_iov_cnt];
00108          struct iovec                wait_iov[wait_iov_cnt];
00109          char                        hostbuff[288];
00110          char                        waitbuff[16];
00111          int                         Tslice;
00112          int                         Tdelay;
00113 unsigned int                         myClock;
00114 };
00115 
00116 namespace XrdOlb
00117 {
00118 extern    XrdOlbRRQ RRQ;
00119 }
00120 #endif

Generated on Wed Sep 1 2010 for xrootd by  doxygen 1.7.1