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