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 <netinet/in.h>
34 
35 #include "XrdCms/XrdCmsKey.hh"
36 
37 /******************************************************************************/
38 /* C l a s s X r d C m s S e l e c t */
39 /******************************************************************************/
40 
41 class XrdCmsRRQInfo;
42 
44 {
45 public:
46 XrdCmsKey Path; // In: Path to select or lookup in the cache
47 XrdCmsRRQInfo *InfoP; // In: Fast redirect routing
48 SMask_t nmask; // In: Nodes to avoid
49 SMask_t smask; // Out: Nodes selected
50 struct iovec *iovP; // In: Prepare notification I/O vector
51 int iovN; // In: Prepare notification I/O vector count
52 int Opts; // In: One or more of the following enums
53 
54 enum {Write = 0x00010, // File will be open in write mode (select & cache)
55  NewFile = 0x00020, // File will be created may not exist (select)
56  Online = 0x00040, // Only consider online files (select & prep)
57  Trunc = 0x00080, // File will be truncated (Select only)
58  Create = 0x000A0, // Create file, truncate if exists
59  Defer = 0x00100, // Do not select a server now (prep only)
60  Peers = 0x00200, // Peer clusters may be selected (select only)
61  Refresh = 0x00400, // Cache should be refreshed (all)
62  Asap = 0x00800, // Respond as soon as possible (locate only)
63  noBind = 0x01000, // Do not new bind file to a server (select only)
64  isMeta = 0x02000, // Only inode information being changed(select only)
65  Freshen = 0x04000, // Freshen access times (prep only)
66  Replica = 0x08000, // File will be replicated (w/ Create) (select only)
67  NoTryLim= 0x10000, // Do not apply the retry limit
68  MWFiles = 0x20000, // Multiwrite files allowed (select only)
69  Advisory= 0x40000, // Cache A/D is advisory (no delay) (have & cache)
70  Pending = 0x80000, // File being staged (have & cache)
71  ifWant = 0x0000f, // XrdNetIF::ifType encoding location
72 
73  Pack = 0x00010000, // Packed selection
74  UseRef = 0x00020000 // Selection by reference count only
75  };
76 
77 struct {SMask_t wf; // Out: Writable locations
78  SMask_t hf; // Out: Existing locations
79  SMask_t pf; // Out: Pending locations
80  SMask_t bf; // Out: Bounced locations
81  } Vec;
82 
83 static const int SelDSZ = 256;
84 
85 struct {int Port; // Out: Target node port number
86  char Data[SelDSZ]; // Out: Target node or error message
87  int DLen; // Out: Length of Data including null byte
88  } Resp;
89 
90  XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
91  : Path(thePath,thePLen), InfoP(0), smask(0), Opts(opts)
92  {Resp.Port = 0; *Resp.Data = '\0'; Resp.DLen = 0;}
94 };
95 
96 /******************************************************************************/
97 /* C l a s s X r d C m s S e l e c t e d */
98 /******************************************************************************/
99 
100 class XrdCmsSelected // Argument to List() after select or locate
101 {
102 public:
103 
104 static const int IdentSize = 264;
105 
108 int Id;
109 int IdentLen; // 12345678901234567890123456
110 char Ident[IdentSize]; // [::123.123.123.123]:123456
111 int Port;
114 int Shrin; // Share intervals used
115 char Share; // Share
116 char RoleID; // Role Identifier
117 char Rsvd[2];
118 int Status; // One of the following
119 
120 enum {Disable = 0x0001,
121  NoStage = 0x0002,
122  Offline = 0x0004,
123  Suspend = 0x0008,
124  isRW = 0x0010,
125  isMangr = 0x0100
126  };
127 
129 
131 };
132 
133 /******************************************************************************/
134 /* C l a s s X r d C m s S e l e c t o r */
135 /******************************************************************************/
136 
138 {
139 public:
140 const char *reason;
141  int delay;
142  short nPick;
143  char needNet;
144  char needSpace;
145  bool selPack;
146  bool xFull;
147  bool xNoNet;
148  bool xOff;
149  bool xOvld;
150  bool xSusp;
151 
152 inline void Reset() {reason = 0; delay = 0; nPick = 0;
153  xFull = xNoNet = xOff = xOvld = xSusp = false;
154  }
155 };
156 #endif
XrdCmsSelect::smask
SMask_t smask
Definition: XrdCmsSelect.hh:49
XrdCmsSelect::Write
@ Write
Definition: XrdCmsSelect.hh:54
XrdCmsSelector::delay
int delay
Definition: XrdCmsSelect.hh:141
XrdCmsSelector::xFull
bool xFull
Definition: XrdCmsSelect.hh:146
XrdCmsSelect::Freshen
@ Freshen
Definition: XrdCmsSelect.hh:65
XrdCmsSelect
Definition: XrdCmsSelect.hh:43
SMask_t
unsigned long long SMask_t
Definition: XrdCmsTypes.hh:33
XrdCmsSelect::SelDSZ
static const int SelDSZ
Definition: XrdCmsSelect.hh:83
XrdCmsSelected::Shrin
int Shrin
Definition: XrdCmsSelect.hh:114
XrdCmsSelect::Online
@ Online
Definition: XrdCmsSelect.hh:56
XrdCmsSelector::nPick
short nPick
Definition: XrdCmsSelect.hh:142
XrdCmsSelected::Status
int Status
Definition: XrdCmsSelect.hh:118
XrdCmsSelect::nmask
SMask_t nmask
Definition: XrdCmsSelect.hh:48
XrdCmsSelect::bf
SMask_t bf
Definition: XrdCmsSelect.hh:80
XrdCmsSelect::Refresh
@ Refresh
Definition: XrdCmsSelect.hh:61
XrdCmsSelected::RefTotW
int RefTotW
Definition: XrdCmsSelect.hh:112
XrdCmsSelect::NewFile
@ NewFile
Definition: XrdCmsSelect.hh:55
XrdCmsSelect::isMeta
@ isMeta
Definition: XrdCmsSelect.hh:64
XrdCmsSelector::Reset
void Reset()
Definition: XrdCmsSelect.hh:152
XrdCmsSelect::UseRef
@ UseRef
Definition: XrdCmsSelect.hh:74
XrdCmsSelected::NoStage
@ NoStage
Definition: XrdCmsSelect.hh:121
XrdCmsSelected::isMangr
@ isMangr
Definition: XrdCmsSelect.hh:125
XrdCmsSelected::Offline
@ Offline
Definition: XrdCmsSelect.hh:122
XrdCmsSelect::XrdCmsSelect
XrdCmsSelect(int opts=0, char *thePath=0, int thePLen=0)
Definition: XrdCmsSelect.hh:90
XrdCmsSelected::Suspend
@ Suspend
Definition: XrdCmsSelect.hh:123
XrdCmsSelector::reason
const char * reason
Definition: XrdCmsSelect.hh:140
XrdCmsSelect::NoTryLim
@ NoTryLim
Definition: XrdCmsSelect.hh:67
XrdCmsSelect::Replica
@ Replica
Definition: XrdCmsSelect.hh:66
XrdCmsSelect::Advisory
@ Advisory
Definition: XrdCmsSelect.hh:69
XrdCmsSelect::wf
SMask_t wf
Definition: XrdCmsSelect.hh:77
XrdCmsSelect::MWFiles
@ MWFiles
Definition: XrdCmsSelect.hh:68
XrdCmsSelect::Path
XrdCmsKey Path
Definition: XrdCmsSelect.hh:46
XrdCmsSelected::RoleID
char RoleID
Definition: XrdCmsSelect.hh:116
XrdCmsSelect::Pending
@ Pending
Definition: XrdCmsSelect.hh:70
XrdCmsSelector::xSusp
bool xSusp
Definition: XrdCmsSelect.hh:150
XrdCmsSelected::next
XrdCmsSelected * next
Definition: XrdCmsSelect.hh:106
XrdCmsSelected::isRW
@ isRW
Definition: XrdCmsSelect.hh:124
XrdCmsSelected::Disable
@ Disable
Definition: XrdCmsSelect.hh:120
XrdCmsSelected::Id
int Id
Definition: XrdCmsSelect.hh:108
XrdCmsSelect::pf
SMask_t pf
Definition: XrdCmsSelect.hh:79
XrdCmsSelect::Peers
@ Peers
Definition: XrdCmsSelect.hh:60
XrdCmsSelect::Opts
int Opts
Definition: XrdCmsSelect.hh:52
XrdCmsRRQInfo
Definition: XrdCmsRRQ.hh:46
XrdCmsSelect::noBind
@ noBind
Definition: XrdCmsSelect.hh:63
XrdCmsSelect::~XrdCmsSelect
~XrdCmsSelect()
Definition: XrdCmsSelect.hh:93
XrdCmsSelect::iovN
int iovN
Definition: XrdCmsSelect.hh:51
XrdCmsSelected
Definition: XrdCmsSelect.hh:100
XrdCmsSelect::DLen
int DLen
Definition: XrdCmsSelect.hh:87
XrdCmsKey.hh
XrdCmsSelect::Create
@ Create
Definition: XrdCmsSelect.hh:58
XrdCmsSelected::IdentSize
static const int IdentSize
Definition: XrdCmsSelect.hh:104
XrdCmsSelector::needNet
char needNet
Definition: XrdCmsSelect.hh:143
XrdCmsSelected::IdentLen
int IdentLen
Definition: XrdCmsSelect.hh:109
XrdCmsSelector::xOff
bool xOff
Definition: XrdCmsSelect.hh:148
XrdCmsSelected::Share
char Share
Definition: XrdCmsSelect.hh:115
XrdCmsSelected::Ident
char Ident[IdentSize]
Definition: XrdCmsSelect.hh:110
XrdCmsSelect::ifWant
@ ifWant
Definition: XrdCmsSelect.hh:71
XrdCmsSelect::Data
char Data[SelDSZ]
Definition: XrdCmsSelect.hh:86
XrdCmsSelected::~XrdCmsSelected
~XrdCmsSelected()
Definition: XrdCmsSelect.hh:130
XrdCmsSelected::Mask
SMask_t Mask
Definition: XrdCmsSelect.hh:107
XrdCmsSelector::xNoNet
bool xNoNet
Definition: XrdCmsSelect.hh:147
XrdCmsSelect::Resp
struct XrdCmsSelect::@64 Resp
XrdCmsSelect::Asap
@ Asap
Definition: XrdCmsSelect.hh:62
XrdCmsSelector::xOvld
bool xOvld
Definition: XrdCmsSelect.hh:149
XrdCmsSelector::needSpace
char needSpace
Definition: XrdCmsSelect.hh:144
XrdCmsSelector
Definition: XrdCmsSelect.hh:137
XrdCmsSelect::iovP
struct iovec * iovP
Definition: XrdCmsSelect.hh:50
XrdCmsSelect::Defer
@ Defer
Definition: XrdCmsSelect.hh:59
XrdCmsSelect::Trunc
@ Trunc
Definition: XrdCmsSelect.hh:57
XrdCmsSelect::Vec
struct XrdCmsSelect::@63 Vec
XrdCmsKey
Definition: XrdCmsKey.hh:47
XrdCmsSelect::Pack
@ Pack
Definition: XrdCmsSelect.hh:73
XrdCmsSelected::Port
int Port
Definition: XrdCmsSelect.hh:111
XrdCmsSelected::XrdCmsSelected
XrdCmsSelected(XrdCmsSelected *np=0)
Definition: XrdCmsSelect.hh:128
XrdCmsSelect::hf
SMask_t hf
Definition: XrdCmsSelect.hh:78
XrdCmsSelected::Rsvd
char Rsvd[2]
Definition: XrdCmsSelect.hh:117
XrdCmsSelector::selPack
bool selPack
Definition: XrdCmsSelect.hh:145
XrdCmsSelect::InfoP
XrdCmsRRQInfo * InfoP
Definition: XrdCmsSelect.hh:47
XrdCmsSelected::RefTotR
int RefTotR
Definition: XrdCmsSelect.hh:113
XrdCmsSelect::Port
int Port
Definition: XrdCmsSelect.hh:85