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 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "XrdCms/XrdCmsKey.hh"
34 
35 /******************************************************************************/
36 /* C l a s s X r d C m s S e l e c t */
37 /******************************************************************************/
38 
39 class XrdCmsRRQInfo;
40 
42 {
43 public:
44 XrdCmsKey Path; // In: Path to select or lookup in the cache
45 XrdCmsRRQInfo *InfoP; // In: Fast redirect routing
46 SMask_t nmask; // In: Nodes to avoid
47 SMask_t smask; // Out: Nodes selected
48 struct iovec *iovP; // In: Prepare notification I/O vector
49 int iovN; // In: Prepare notification I/O vector count
50 int Opts; // In: One or more of the following enums
51 
52 enum {Write = 0x0001, // File will be open in write mode (select & cache)
53  NewFile = 0x0002, // File will be created may not exist (select)
54  Online = 0x0004, // Only consider online files (select & prep)
55  Trunc = 0x0008, // File will be truncated (Select only)
56  Create = 0x000A, // Create file, truncate if exists
57  Defer = 0x0010, // Do not select a server now (prep only)
58  Peers = 0x0020, // Peer clusters may be selected (select only)
59  Refresh = 0x0040, // Cache should be refreshed (all)
60  Asap = 0x0080, // Respond as soon as possible (locate only)
61  noBind = 0x0100, // Do not new bind file to a server (select only)
62  isMeta = 0x0200, // Only inode information being changed(select only)
63  Freshen = 0x0400, // Freshen access times (prep only)
64  Replica = 0x0800, // File will be replicated (w/ Create) (select only)
65  Advisory= 0x4000, // Cache A/D is advisory (no delay) (have & cache)
66  Pending = 0x8000 // File being staged (have & cache)
67  };
68 
69 struct {SMask_t wf; // Out: Writable locations
70  SMask_t hf; // Out: Existing locations
71  SMask_t pf; // Out: Pending locations
72  SMask_t bf; // Out: Bounced locations
73  } Vec;
74 
75 struct {int Port; // Out: Target node port number
76  char Data[256]; // Out: Target node or error message
77  int DLen; // Out: Length of Data including null byte
78  } Resp;
79 
80  XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
81  : Path(thePath,thePLen), InfoP(0), smask(0), Opts(opts)
82  {Resp.Port = 0; *Resp.Data = '\0'; Resp.DLen = 0;}
84 };
85 
86 /******************************************************************************/
87 /* C l a s s X r d C m s S e l e c t e d */
88 /******************************************************************************/
89 
90 class XrdCmsSelected // Argument to List() after select or locate
91 {
92 public:
93 
95 char *Name;
97 int Id;
98 unsigned int IPAddr; // IPV4
99 
100 int Port;
101 int IPV6Len; // 12345678901234567890123456
102 char IPV6[28]; // [::123.123.123.123]:123456
105 int Shrin; // Share intervals used
106 char Share; // Share
107 char RoleID; // Role Identifier
108 char Rsvd[2];
109 int Status; // One of the following
110 
111 enum {Disable = 0x0001,
112  NoStage = 0x0002,
113  Offline = 0x0004,
114  Suspend = 0x0008,
115  isRW = 0x0010,
116  isMangr = 0x0100
117  };
118 
119  XrdCmsSelected(const char *sname, XrdCmsSelected *np=0)
120  {Name = (sname ? strdup(sname) : 0); next=np;}
121 
122  ~XrdCmsSelected() {if (Name) free(Name);}
123 };
124 #endif