xrootd
XrdCmsSelect.hh
Go to the documentation of this file.
00001 #ifndef __CMS_SELECT_HH
00002 #define __CMS_SELECT_HH
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                       X r d C m s S e l e c t . 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 "XrdCms/XrdCmsKey.hh"
00014 
00015 /******************************************************************************/
00016 /*                    C l a s s   X r d C m s S e l e c t                     */
00017 /******************************************************************************/
00018 
00019 class XrdCmsRRQInfo;
00020   
00021 class XrdCmsSelect
00022 {
00023 public:
00024 XrdCmsKey      Path;    //  In: Path to select or lookup in the cache
00025 XrdCmsRRQInfo *InfoP;   //  In: Fast redirect routing
00026 SMask_t        nmask;   //  In: Nodes to avoid
00027 SMask_t        smask;   // Out: Nodes selected
00028 struct iovec  *iovP;    //  In: Prepare notification I/O vector
00029 int            iovN;    //  In: Prepare notification I/O vector count
00030 int            Opts;    //  In: One or more of the following enums
00031 
00032 enum {Write   = 0x0001, // File will be open in write mode     (select & cache)
00033       NewFile = 0x0002, // File will be created may not exist  (select)
00034       Online  = 0x0004, // Only consider online files          (select & prep)
00035       Trunc   = 0x0008, // File will be truncated              (Select   only)
00036       Create  = 0x000A, // Create file, truncate if exists
00037       Defer   = 0x0010, // Do not select a server now          (prep     only)
00038       Peers   = 0x0020, // Peer clusters may be selected       (select   only)
00039       Refresh = 0x0040, // Cache should be refreshed           (all)
00040       Asap    = 0x0080, // Respond as soon as possible         (locate   only)
00041       noBind  = 0x0100, // Do not new bind file to a server    (select   only)
00042       isMeta  = 0x0200, // Only inode information being changed(select   only)
00043       Freshen = 0x0400, // Freshen access times                (prep     only)
00044       Replica = 0x0800, // File will be replicated (w/ Create) (select   only)
00045       Advisory= 0x4000, // Cache A/D is advisory (no delay)    (have   & cache)
00046       Pending = 0x8000  // File being staged                   (have   & cache)
00047      };
00048 
00049 struct {SMask_t wf;     // Out: Writable locations
00050         SMask_t hf;     // Out: Existing locations
00051         SMask_t pf;     // Out: Pending  locations
00052         SMask_t bf;     // Out: Bounced  locations
00053        }        Vec;
00054 
00055 struct {int  Port;      // Out: Target node port number
00056         char Data[256]; // Out: Target node or error message
00057         int  DLen;      // Out: Length of Data including null byte
00058        }     Resp;
00059 
00060              XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
00061                          : Path(thePath,thePLen), smask(0), Opts(opts)
00062                          {Resp.Port = 0; *Resp.Data = '\0'; Resp.DLen = 0;}
00063             ~XrdCmsSelect() {}
00064 };
00065 
00066 /******************************************************************************/
00067 /*                  C l a s s   X r d C m s S e l e c t e d                   */
00068 /******************************************************************************/
00069   
00070 class XrdCmsSelected   // Argument to List() after select or locate
00071 {
00072 public:
00073 
00074 XrdCmsSelected *next;
00075 char           *Name;
00076 SMask_t         Mask;
00077 int             Id;
00078 unsigned int    IPAddr;   // IPV4
00079 
00080 int             Port;
00081 int             IPV6Len;  // 12345678901234567890123456
00082 char            IPV6[28]; // [::123.123.123.123]:123456
00083 int             RefTotW;
00084 int             RefTotR;
00085 int             Shrin;       // Share intervals used
00086 char            Share;       // Share
00087 char            RoleID;      // Role Identifier
00088 char            Rsvd[2];
00089 int             Status;      // One of the following
00090 
00091 enum           {Disable = 0x0001,
00092                 NoStage = 0x0002,
00093                 Offline = 0x0004,
00094                 Suspend = 0x0008,
00095                 isRW    = 0x0010,
00096                 isMangr = 0x0100
00097                };
00098 
00099                XrdCmsSelected(const char *sname, XrdCmsSelected *np=0)
00100                          {Name = (sname ? strdup(sname) : 0); next=np;}
00101 
00102               ~XrdCmsSelected() {if (Name) free(Name);}
00103 };
00104 #endif