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 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00033 #include "XrdCms/XrdCmsKey.hh"
00034 
00035 /******************************************************************************/
00036 /*                    C l a s s   X r d C m s S e l e c t                     */
00037 /******************************************************************************/
00038 
00039 class XrdCmsRRQInfo;
00040   
00041 class XrdCmsSelect
00042 {
00043 public:
00044 XrdCmsKey      Path;    //  In: Path to select or lookup in the cache
00045 XrdCmsRRQInfo *InfoP;   //  In: Fast redirect routing
00046 SMask_t        nmask;   //  In: Nodes to avoid
00047 SMask_t        smask;   // Out: Nodes selected
00048 struct iovec  *iovP;    //  In: Prepare notification I/O vector
00049 int            iovN;    //  In: Prepare notification I/O vector count
00050 int            Opts;    //  In: One or more of the following enums
00051 
00052 enum {Write   = 0x0001, // File will be open in write mode     (select & cache)
00053       NewFile = 0x0002, // File will be created may not exist  (select)
00054       Online  = 0x0004, // Only consider online files          (select & prep)
00055       Trunc   = 0x0008, // File will be truncated              (Select   only)
00056       Create  = 0x000A, // Create file, truncate if exists
00057       Defer   = 0x0010, // Do not select a server now          (prep     only)
00058       Peers   = 0x0020, // Peer clusters may be selected       (select   only)
00059       Refresh = 0x0040, // Cache should be refreshed           (all)
00060       Asap    = 0x0080, // Respond as soon as possible         (locate   only)
00061       noBind  = 0x0100, // Do not new bind file to a server    (select   only)
00062       isMeta  = 0x0200, // Only inode information being changed(select   only)
00063       Freshen = 0x0400, // Freshen access times                (prep     only)
00064       Replica = 0x0800, // File will be replicated (w/ Create) (select   only)
00065       Advisory= 0x4000, // Cache A/D is advisory (no delay)    (have   & cache)
00066       Pending = 0x8000  // File being staged                   (have   & cache)
00067      };
00068 
00069 struct {SMask_t wf;     // Out: Writable locations
00070         SMask_t hf;     // Out: Existing locations
00071         SMask_t pf;     // Out: Pending  locations
00072         SMask_t bf;     // Out: Bounced  locations
00073        }        Vec;
00074 
00075 struct {int  Port;      // Out: Target node port number
00076         char Data[256]; // Out: Target node or error message
00077         int  DLen;      // Out: Length of Data including null byte
00078        }     Resp;
00079 
00080              XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
00081                          : Path(thePath,thePLen), InfoP(0), smask(0), Opts(opts)
00082                          {Resp.Port = 0; *Resp.Data = '\0'; Resp.DLen = 0;}
00083             ~XrdCmsSelect() {}
00084 };
00085 
00086 /******************************************************************************/
00087 /*                  C l a s s   X r d C m s S e l e c t e d                   */
00088 /******************************************************************************/
00089   
00090 class XrdCmsSelected   // Argument to List() after select or locate
00091 {
00092 public:
00093 
00094 XrdCmsSelected *next;
00095 char           *Name;
00096 SMask_t         Mask;
00097 int             Id;
00098 unsigned int    IPAddr;   // IPV4
00099 
00100 int             Port;
00101 int             IPV6Len;  // 12345678901234567890123456
00102 char            IPV6[28]; // [::123.123.123.123]:123456
00103 int             RefTotW;
00104 int             RefTotR;
00105 int             Shrin;       // Share intervals used
00106 char            Share;       // Share
00107 char            RoleID;      // Role Identifier
00108 char            Rsvd[2];
00109 int             Status;      // One of the following
00110 
00111 enum           {Disable = 0x0001,
00112                 NoStage = 0x0002,
00113                 Offline = 0x0004,
00114                 Suspend = 0x0008,
00115                 isRW    = 0x0010,
00116                 isMangr = 0x0100
00117                };
00118 
00119                XrdCmsSelected(const char *sname, XrdCmsSelected *np=0)
00120                          {Name = (sname ? strdup(sname) : 0); next=np;}
00121 
00122               ~XrdCmsSelected() {if (Name) free(Name);}
00123 };
00124 #endif