xrootd
XrdCmsSelect.hh
Go to the documentation of this file.
1 #ifndef __CMS_SELECT_HH
2 #define __CMS_SELECT_HH
3 /******************************************************************************/
4 /* */
5 /* X r d C m s S e l e c t . h h */
6 /* */
7 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 #include "XrdCms/XrdCmsKey.hh"
14 
15 /******************************************************************************/
16 /* C l a s s X r d C m s S e l e c t */
17 /******************************************************************************/
18 
19 class XrdCmsRRQInfo;
20 
22 {
23 public:
24 XrdCmsKey Path; // In: Path to select or lookup in the cache
25 XrdCmsRRQInfo *InfoP; // In: Fast redirect routing
26 SMask_t nmask; // In: Nodes to avoid
27 SMask_t smask; // Out: Nodes selected
28 struct iovec *iovP; // In: Prepare notification I/O vector
29 int iovN; // In: Prepare notification I/O vector count
30 int Opts; // In: One or more of the following enums
31 
32 enum {Write = 0x0001, // File will be open in write mode (select & cache)
33  NewFile = 0x0002, // File will be created may not exist (select)
34  Online = 0x0004, // Only consider online files (select & prep)
35  Trunc = 0x0008, // File will be truncated (Select only)
36  Create = 0x000A, // Create file, truncate if exists
37  Defer = 0x0010, // Do not select a server now (prep only)
38  Peers = 0x0020, // Peer clusters may be selected (select only)
39  Refresh = 0x0040, // Cache should be refreshed (all)
40  Asap = 0x0080, // Respond as soon as possible (locate only)
41  noBind = 0x0100, // Do not new bind file to a server (select only)
42  isMeta = 0x0200, // Only inode information being changed(select only)
43  Freshen = 0x0400, // Freshen access times (prep only)
44  Replica = 0x0800, // File will be replicated (w/ Create) (select only)
45  Advisory= 0x4000, // Cache A/D is advisory (no delay) (have & cache)
46  Pending = 0x8000 // File being staged (have & cache)
47  };
48 
49 struct {SMask_t wf; // Out: Writable locations
50  SMask_t hf; // Out: Existing locations
51  SMask_t pf; // Out: Pending locations
52  SMask_t bf; // Out: Bounced locations
53  } Vec;
54 
55 struct {int Port; // Out: Target node port number
56  char Data[256]; // Out: Target node or error message
57  int DLen; // Out: Length of Data including null byte
58  } Resp;
59 
60  XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
61  : Path(thePath,thePLen), smask(0), Opts(opts)
62  {Resp.Port = 0; *Resp.Data = '\0'; Resp.DLen = 0;}
64 };
65 
66 /******************************************************************************/
67 /* C l a s s X r d C m s S e l e c t e d */
68 /******************************************************************************/
69 
70 class XrdCmsSelected // Argument to List() after select or locate
71 {
72 public:
73 
75 char *Name;
77 int Id;
78 unsigned int IPAddr; // IPV4
79 
80 int Port;
81 int IPV6Len; // 12345678901234567890123456
82 char IPV6[28]; // [::123.123.123.123]:123456
83 int RefTotW;
84 int RefTotR;
85 int Shrin; // Share intervals used
86 char Share; // Share
87 char RoleID; // Role Identifier
88 char Rsvd[2];
89 int Status; // One of the following
90 
91 enum {Disable = 0x0001,
92  NoStage = 0x0002,
93  Offline = 0x0004,
94  Suspend = 0x0008,
95  isRW = 0x0010,
96  isMangr = 0x0100
97  };
98 
99  XrdCmsSelected(const char *sname, XrdCmsSelected *np=0)
100  {Name = (sname ? strdup(sname) : 0); next=np;}
101 
102  ~XrdCmsSelected() {if (Name) free(Name);}
103 };
104 #endif