17
17
class EndpointQueryingStatus;
18
18
class ComputingEndpointAttributes;
20
/// Key comparison object definition for Endpoint objects
22
* \since Added in 3.0.0.
22
24
* \headerfile Endpoint.h arc/compute/Endpoint.h
24
26
typedef bool (*EndpointCompareFn)(const Endpoint&, const Endpoint&);
28
/// Status map for Endpoint objects.
30
* Wrapper class inheriting from std::map providing no extra functionality than
31
* that of std::map. It is needed due to limitations in the language wrapping
32
* software (SWIG) that can't handle more than 2 template arguments.
34
* \since Added in 3.0.0.
28
36
* \headerfile Endpoint.h arc/compute/Endpoint.h
30
38
class EndpointStatusMap : public std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn> {
40
/// Creates a std::map with the key comparison object set to Endpoint::ServiceIDCompare
32
41
EndpointStatusMap();
42
/// Creates a std::map using \c fn as key comparison object
33
43
EndpointStatusMap(EndpointCompareFn fn) : std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn>(fn) {}
34
45
EndpointStatusMap(const EndpointStatusMap& m) : std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn>(m) {}
35
46
~EndpointStatusMap() {}
38
49
/// Represents an endpoint of a service with a given interface type and capabilities
40
* The type of the interface is described by a string called InterfaceName (from
41
* the %GLUE2 specification). An Endpoint object must have a URL, and it is
42
* quite useless without capabilities (the system has to know if an Endpoint is
43
* a service registry or a computing element), but the InterfaceName is
51
* This class similar in structure to the %Endpoint entity in the %GLUE2
52
* specification. The type of the interface is described by a string called
53
* InterfaceName (from the %GLUE2 specification). An Endpoint object must have a
54
* URL, and it is quite useless without capabilities (the system has to know if
55
* an Endpoint is a service registry or a computing element), but the
56
* InterfaceName is optional.
46
58
* The Endpoint object also contains information about the health state and
47
59
* quality level of the endpoint, and optionally the requested submission
49
61
* computing element related to this endpoint.
51
63
* \see CapabilityEnum where the capabilities are listed.
64
* \since Added in 2.0.0.
53
66
* \headerfile Endpoint.h arc/compute/Endpoint.h
58
- REGISTRY: service registry capable of returning endpoints
59
- COMPUTINGINFO: local information system of a computing element
60
capable of returning information about the resource
61
- JOBLIST: local information system of a computing element
62
capable of returning the list of jobs on the resource
63
- JOBSUBMIT: interface of a computing element where jobs can be submitted
64
- JOBCREATION: interface of a computing element where jobs can be created
65
- UNSPECIFIED: unspecified capability
67
enum CapabilityEnum { REGISTRY, COMPUTINGINFO, JOBLIST, JOBSUBMIT, JOBCREATION, JOBMANAGEMENT, UNSPECIFIED};
70
/// Values for classifying capabilities of services
72
/// Service registry capable of returning endpoints
74
/// Local information system of a computing element capable of returning information about the resource
76
/// Local information system of a computing element capable of returning the list of jobs on the resource
78
/// Interface of a computing element where jobs can be submitted
80
/// Interface of a computing element where jobs can be created
82
* \since Added in 3.0.0.
85
/// Interface of a computing element where jobs can be managed
87
/// Unspecified capability
69
/** Get the string representation of the given #CapabilityEnum. */
91
/// Get string representation of #CapabilityEnum.
93
* \return The %GLUE2 capability string associated with the passed
94
* #CapabilityEnum value is returned.
70
96
static std::string GetStringForCapability(Endpoint::CapabilityEnum cap) {
71
97
if (cap == Endpoint::REGISTRY) return "information.discovery.registry";
72
98
if (cap == Endpoint::COMPUTINGINFO) return "information.discovery.resource";
105
131
* \param e ExecutionTarget object to create new Endpoint from.
106
132
* \param rsi string specifying the requested submission interface if any.
107
133
* Default value is the empty string.
134
* \since Added in 3.0.0.
109
136
Endpoint(const ExecutionTarget& e, const std::string& rsi = "");
111
/// Create new Endpoint from ExecutionTarget object
138
/// Create new Endpoint from ComputingEndpointAttributes object
113
140
* \param cea ComputingEndpointAttributes object to create new Endpoint from.
114
141
* \param rsi string specifying the requested submission interface if any.
115
142
* Default value is the empty string.
143
* \since Added in 3.0.0.
117
145
Endpoint(const ComputingEndpointAttributes& cea, const std::string& rsi = "");
119
147
/// Create a new Endpoint from a ConfigEndpoint
121
The URL, InterfaceName and the RequestedSubmissionInterfaceName will be copied
122
from the ConfigEndpoint, and if the type of the ConfigEndpoint is REGISTRY or
123
COMPUTINGINFO, the given capability will be added to the new Endpoint object.
124
\param[in] endpoint is the ConfigEndpoint object which will be converted to an Endpoint
126
This will call #operator=.
149
* The ConfigEndpoint::URLString, ConfigEndpoint::InterfaceName and the
150
* ConfigEndpoint::RequestedSubmissionInterfaceName attributes will be copied
151
* from the ConfigEndpoint, and if the type of the ConfigEndpoint is #REGISTRY
152
* or #COMPUTINGINFO, the given capability will be added to the new Endpoint
155
* \param[in] endpoint is the ConfigEndpoint object which will be converted to
128
158
Endpoint(const ConfigEndpoint& endpoint) { *this = endpoint; }
130
/** Checks if the Endpoint has the given capability specified by a CapabilityEnum
131
\param[in] cap is the specified CapabilityEnum
132
\return true if the Endpoint has the given capability
160
/// Check for capability
162
* Checks if the Endpoint has the given capability specified by a
163
* #CapabilityEnum value.
165
* \param[in] cap is the specified #CapabilityEnum
166
* \return true if the Endpoint has the given capability
134
168
bool HasCapability(Endpoint::CapabilityEnum cap) const;
136
/** Checks if the Endpoint has the given capability specified by a string
137
\param[in] cap is a string specifying a capability
138
\return true if the Endpoint has the given capability
170
/// Check for capability
172
* Checks if the Endpoint has the given capability specified by a string.
174
* \param[in] cap is a string specifying a capability.
175
* \return true if the Endpoint has the given capability.
140
177
bool HasCapability(const std::string& cap) const;
142
/** Returns a string representation of the Endpoint containing the URL,
143
the main capability and the InterfaceName
179
/// Get string representation of this object
181
* \return String formatted as:
183
<URLString> (<InterfaceName>[, capabilities: <Capabilities space separated>])
185
* where if #InterfaceName is empty, "<empty InterfaceName>" is used.
145
187
std::string str() const;
147
/** A string identifying the service exposing this endpoint. It currently
148
extracts the host name from the URL, but this may be refined later. */
189
/// Get name of service from #URLString attribute
191
* \return If #URLString contains "://", a URL object will be created from it
192
* and if the host part of it is non empty it is returned, otherwise
193
* #URLString is returned.
194
* \since Added in 3.0.0.
149
196
std::string getServiceName() const;
151
/** Needed for std::map to be able to sort the keys */
198
/// Key comparison method
200
* Compare passed Endpoint object with this by value returned by #str().
202
* \param[in] other Endpoint object to compare with.
203
* \return The result of lexicographically less between this object (lhs) and
204
* other (rhs) compared using value returned by #str() method, is returned.
152
206
bool operator<(const Endpoint& other) const;
208
/// Key comparison function for comparing Endpoint objects.
210
* Compare endpoints by #ServiceID, #URLString and #InterfaceName in that
211
* order. The attributes are compared lexicographically.
213
* \return If the ServiceID attributes are unequal lexicographically less
214
* between the ServiceID attributes of a and b is returned. If they equal then
215
* same procedure is done with the URLString attribute, if they equal
216
* lexicographically less between the InterfaceName attributes of a and b is
219
* \since Added in 3.0.0.
154
221
static bool ServiceIDCompare(const Endpoint& a, const Endpoint& b);
156
/** Copy a ConfigEndpoint into the Endpoint */
223
/// Set from a ConfigEndpoint object
225
* \return \c *this is returned.
157
227
Endpoint& operator=(const ConfigEndpoint& e);
159
/** The string representation of the URL of the Endpoint */
229
/// The string representation of the URL of the Endpoint
160
230
std::string URLString;
161
/** The type of the interface (GLUE2 InterfaceName) */
231
/// The type of the interface (%GLUE2 InterfaceName)
162
232
std::string InterfaceName;
163
/** GLUE2 HealthState */
233
/// %GLUE2 HealthState
164
234
std::string HealthState;
165
/** GLUE2 HealthStateInfo */
235
/// %GLUE2 HealthStateInfo
166
236
std::string HealthStateInfo;
167
/** GLUE2 QualityLevel */
237
/// %GLUE2 QualityLevel
168
238
std::string QualityLevel;
169
/** Set of GLUE2 Capability strings */
239
/// Set of %GLUE2 Capability strings
170
240
std::set<std::string> Capability;
171
/** A GLUE2 InterfaceName requesting an InterfaceName used for job submission.
173
If a user specifies an InterfaceName for submitting jobs, that information
174
will be stored here and will be used when collecting information about the
175
computing element. Only those job submission interfaces will be considered
176
which has this requested InterfaceName.
241
/// A %GLUE2 InterfaceName requesting an InterfaceName used for job submission.
243
* If a user specifies an InterfaceName for submitting jobs, that information
244
* will be stored here and will be used when collecting information about the
245
* computing element. Only those job submission interfaces will be considered
246
* which has this requested InterfaceName.
178
248
std::string RequestedSubmissionInterfaceName;
179
/** The ID of the service this Endpoint belongs to */
249
/// ID of service this Endpoint belongs to
251
* \since Added in 3.0.0.
180
253
std::string ServiceID;
255
/// Get bounds in EndpointStatusMap corresponding to Endpoint
257
* \param[in] endpoint An Endpoint object for which the bounds of equivalent
258
* Endpoint objects in the EndpointStatusMap should be found.
259
* \param[in] statusMap See description above.
260
* \return The lower and upper bound of the equivalent to the passed Endpoint
261
* object is returned as a pair (lower, upper).
182
263
static std::pair<EndpointStatusMap::const_iterator, EndpointStatusMap::const_iterator> getServiceEndpoints(const Endpoint&, const EndpointStatusMap&);