/usr/include/arc/compute/Endpoint.h is in nordugrid-arc-dev 4.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | #ifndef __ARC_ENDPOINT_H__
#define __ARC_ENDPOINT_H__
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <arc/URL.h>
#include <arc/compute/EndpointQueryingStatus.h>
namespace Arc {
class ConfigEndpoint;
class ExecutionTarget;
class Endpoint;
class EndpointQueryingStatus;
class ComputingEndpointAttributes;
/// Key comparison object definition for Endpoint objects
/**
* \since Added in 3.0.0.
* \ingroup compute
* \headerfile Endpoint.h arc/compute/Endpoint.h
*/
typedef bool (*EndpointCompareFn)(const Endpoint&, const Endpoint&);
/// Status map for Endpoint objects.
/**
* Wrapper class inheriting from std::map providing no extra functionality than
* that of std::map. It is needed due to limitations in the language wrapping
* software (SWIG) that can't handle more than 2 template arguments.
*
* \since Added in 3.0.0.
* \ingroup compute
* \headerfile Endpoint.h arc/compute/Endpoint.h
*/
class EndpointStatusMap : public std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn> {
public:
/// Creates a std::map with the key comparison object set to Endpoint::ServiceIDCompare
EndpointStatusMap();
/// Creates a std::map using \c fn as key comparison object
EndpointStatusMap(EndpointCompareFn fn) : std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn>(fn) {}
/// Copy constructor
EndpointStatusMap(const EndpointStatusMap& m) : std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn>(m) {}
~EndpointStatusMap() {}
};
/// Represents an endpoint of a service with a given interface type and capabilities
/**
* This class similar in structure to the %Endpoint entity in the %GLUE2
* specification. The type of the interface is described by a string called
* InterfaceName (from the %GLUE2 specification). An Endpoint object must have a
* URL, and it is quite useless without capabilities (the system has to know if
* an Endpoint is a service registry or a computing element), but the
* InterfaceName is optional.
*
* The Endpoint object also contains information about the health state and
* quality level of the endpoint, and optionally the requested submission
* interface name, which will be used later if a job will be submitted to a
* computing element related to this endpoint.
*
* \see CapabilityEnum where the capabilities are listed.
* \since Added in 2.0.0.
* \ingroup compute
* \headerfile Endpoint.h arc/compute/Endpoint.h
*/
class Endpoint {
public:
/// Values for classifying capabilities of services
enum CapabilityEnum {
/// Service registry capable of returning endpoints
REGISTRY,
/// Local information system of a computing element capable of returning information about the resource
COMPUTINGINFO,
/// Local information system of a computing element capable of returning the list of jobs on the resource
JOBLIST,
/// Interface of a computing element where jobs can be submitted
JOBSUBMIT,
/// Interface of a computing element where jobs can be created
/**
* \since Added in 3.0.0.
**/
JOBCREATION,
/// Interface of a computing element where jobs can be managed
JOBMANAGEMENT,
/// Unspecified capability
UNSPECIFIED
};
/// Get string representation of #CapabilityEnum.
/**
* \return The %GLUE2 capability string associated with the passed
* #CapabilityEnum value is returned.
**/
static std::string GetStringForCapability(Endpoint::CapabilityEnum cap) {
if (cap == Endpoint::REGISTRY) return "information.discovery.registry";
if (cap == Endpoint::COMPUTINGINFO) return "information.discovery.resource";
if (cap == Endpoint::JOBLIST) return "information.discovery.resource";
if (cap == Endpoint::JOBSUBMIT) return "executionmanagement.jobexecution";
if (cap == Endpoint::JOBCREATION) return "executionmanagement.jobcreation";
if (cap == Endpoint::JOBMANAGEMENT) return "executionmanagement.jobmanager";
return "";
}
/// Create a new Endpoint with a list of capability strings
/**
\param[in] URLString is a string representing the URL of the endpoint
\param[in] Capability is a list of capability strings
specifying the capabilities of the service
\param[in] InterfaceName is a string specifying the type of the interface of the service
*/
Endpoint(const std::string& URLString = "",
const std::set<std::string>& Capability = std::set<std::string>(),
const std::string& InterfaceName = "")
: URLString(URLString), InterfaceName(InterfaceName), Capability(Capability) {}
/// Create a new Endpoint with a single capability specified by the #CapabilityEnum
/**
\param[in] URLString is a string representing the URL of the endpoint
\param[in] cap is a #CapabilityEnum specifying the single capability of the endpoint
\param[in] InterfaceName is an optional string specifying the type of the interface
*/
Endpoint(const std::string& URLString,
const Endpoint::CapabilityEnum cap,
const std::string& InterfaceName = "")
: URLString(URLString), InterfaceName(InterfaceName), Capability() { Capability.insert(GetStringForCapability(cap)); }
/// Create new Endpoint from ExecutionTarget object
/**
* \param e ExecutionTarget object to create new Endpoint from.
* \param rsi string specifying the requested submission interface if any.
* Default value is the empty string.
* \since Added in 3.0.0.
**/
Endpoint(const ExecutionTarget& e, const std::string& rsi = "");
/// Create new Endpoint from ComputingEndpointAttributes object
/**
* \param cea ComputingEndpointAttributes object to create new Endpoint from.
* \param rsi string specifying the requested submission interface if any.
* Default value is the empty string.
* \since Added in 3.0.0.
**/
Endpoint(const ComputingEndpointAttributes& cea, const std::string& rsi = "");
/// Create a new Endpoint from a ConfigEndpoint
/**
* The ConfigEndpoint::URLString, ConfigEndpoint::InterfaceName and the
* ConfigEndpoint::RequestedSubmissionInterfaceName attributes will be copied
* from the ConfigEndpoint, and if the type of the ConfigEndpoint is #REGISTRY
* or #COMPUTINGINFO, the given capability will be added to the new Endpoint
* object.
*
* \param[in] endpoint is the ConfigEndpoint object which will be converted to
* an Endpoint
**/
Endpoint(const ConfigEndpoint& endpoint) { *this = endpoint; }
/// Check for capability
/**
* Checks if the Endpoint has the given capability specified by a
* #CapabilityEnum value.
*
* \param[in] cap is the specified #CapabilityEnum
* \return true if the Endpoint has the given capability
*/
bool HasCapability(Endpoint::CapabilityEnum cap) const;
/// Check for capability
/**
* Checks if the Endpoint has the given capability specified by a string.
*
* \param[in] cap is a string specifying a capability.
* \return true if the Endpoint has the given capability.
*/
bool HasCapability(const std::string& cap) const;
/// Get string representation of this object
/**
* \return String formatted as:
* \verbatim
<URLString> (<InterfaceName>[, capabilities: <Capabilities space separated>])
\endverbatim
* where if #InterfaceName is empty, "<empty InterfaceName>" is used.
**/
std::string str() const;
/// Get name of service from #URLString attribute
/**
* \return If #URLString contains "://", a URL object will be created from it
* and if the host part of it is non empty it is returned, otherwise
* #URLString is returned.
* \since Added in 3.0.0.
**/
std::string getServiceName() const;
/// Key comparison method
/**
* Compare passed Endpoint object with this by value returned by #str().
*
* \param[in] other Endpoint object to compare with.
* \return The result of lexicographically less between this object (lhs) and
* other (rhs) compared using value returned by #str() method, is returned.
**/
bool operator<(const Endpoint& other) const;
/// Key comparison function for comparing Endpoint objects.
/**
* Compare endpoints by #ServiceID, #URLString and #InterfaceName in that
* order. The attributes are compared lexicographically.
*
* \return If the ServiceID attributes are unequal lexicographically less
* between the ServiceID attributes of a and b is returned. If they equal then
* same procedure is done with the URLString attribute, if they equal
* lexicographically less between the InterfaceName attributes of a and b is
* returned.
*
* \since Added in 3.0.0.
**/
static bool ServiceIDCompare(const Endpoint& a, const Endpoint& b);
/// Set from a ConfigEndpoint object
/**
* \return \c *this is returned.
**/
Endpoint& operator=(const ConfigEndpoint& e);
/// The string representation of the URL of the Endpoint
std::string URLString;
/// The type of the interface (%GLUE2 InterfaceName)
std::string InterfaceName;
/// %GLUE2 HealthState
std::string HealthState;
/// %GLUE2 HealthStateInfo
std::string HealthStateInfo;
/// %GLUE2 QualityLevel
std::string QualityLevel;
/// Set of %GLUE2 Capability strings
std::set<std::string> Capability;
/// A %GLUE2 InterfaceName requesting an InterfaceName used for job submission.
/**
* If a user specifies an InterfaceName for submitting jobs, that information
* will be stored here and will be used when collecting information about the
* computing element. Only those job submission interfaces will be considered
* which has this requested InterfaceName.
**/
std::string RequestedSubmissionInterfaceName;
/// ID of service this Endpoint belongs to
/**
* \since Added in 3.0.0.
**/
std::string ServiceID;
/// Get bounds in EndpointStatusMap corresponding to Endpoint
/**
* \param[in] endpoint An Endpoint object for which the bounds of equivalent
* Endpoint objects in the EndpointStatusMap should be found.
* \param[in] statusMap See description above.
* \return The lower and upper bound of the equivalent to the passed Endpoint
* object is returned as a pair (lower, upper).
**/
static std::pair<EndpointStatusMap::const_iterator, EndpointStatusMap::const_iterator> getServiceEndpoints(const Endpoint&, const EndpointStatusMap&);
};
} // namespace Arc
#endif // __ARC_ENDPOINT_H__
|