/usr/include/arc/compute/BrokerPlugin.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 | // -*- indent-tabs-mode: nil -*-
#ifndef __ARC_BROKERPLUGIN_H__
#define __ARC_BROKERPLUGIN_H__
/** \file
* \brief Plugin, loader and argument classes for broker specialisation.
*/
#include <arc/loader/Loader.h>
#include <arc/loader/Plugin.h>
namespace Arc {
class ExecutionTarget;
class JobDescription;
class Logger;
class URL;
class UserConfig;
/// Internal class representing arguments passed to BrokerPlugin.
/**
* \ingroup accplugins
* \headerfile BrokerPlugin.h arc/compute/BrokerPlugin.h
*/
class BrokerPluginArgument : public PluginArgument {
public:
BrokerPluginArgument(const UserConfig& uc) : uc(uc) {}
~BrokerPluginArgument() {}
operator const UserConfig&() const { return uc; }
private:
const UserConfig& uc;
};
/// Base class for BrokerPlugins implementing different brokering algorithms.
/**
* Sub-classes implement their own version of a brokering algorithm based on
* certain attributes of the job or targets. match() is called for each
* ExecutionTarget and sub-classes should in general first call
* BrokerPlugin::match(), which calls Broker::genericMatch(), to check that
* basic requirements are satisfied, and then do their own additional checks.
* In order for the targets to be ranked using operator() the sub-class
* should store appropriate data about each target during match().
* \ingroup accplugins
* \headerfile BrokerPlugin.h arc/compute/BrokerPlugin.h
*/
class BrokerPlugin : public Plugin {
public:
/// Should never be called directly - instead use BrokerPluginLoader.load().
BrokerPlugin(BrokerPluginArgument* arg) : Plugin(arg), uc(*arg), j(NULL) {}
/// Sorting operator - returns true if lhs a better target than rhs.
virtual bool operator() (const ExecutionTarget& lhs, const ExecutionTarget& rhs) const;
/// Returns true if the target is acceptable for the BrokerPlugin.
virtual bool match(const ExecutionTarget& et) const;
/// Set the JobDescription to be used for brokering.
virtual void set(const JobDescription& _j) const;
protected:
const UserConfig& uc;
mutable const JobDescription* j;
static Logger logger;
};
/// Handles loading of the required BrokerPlugin plugin.
/**
* \ingroup accplugins
* \headerfile BrokerPlugin.h arc/compute/BrokerPlugin.h
*/
class BrokerPluginLoader : public Loader {
public:
/// Load the base configuration of plugin locations etc.
BrokerPluginLoader();
/// If keep_ownership in load() is true then BrokerPlugin objects are deleted.
~BrokerPluginLoader();
/// Load the BrokerPlugin with the given name.
BrokerPlugin* load(const UserConfig& uc, const std::string& name = "", bool keep_ownerskip = true);
/// Load the BrokerPlugin with the given name and set the JobDescription in it.
BrokerPlugin* load(const UserConfig& uc, const JobDescription& j, const std::string& name = "", bool keep_ownerskip = true);
/// Copy a BrokerPlugin.
BrokerPlugin* copy(const BrokerPlugin* p, bool keep_ownerskip = true);
private:
BrokerPlugin* load(const UserConfig& uc, const JobDescription* j, const std::string& name, bool keep_ownerskip);
std::list<BrokerPlugin*> plugins;
};
} // namespace Arc
#endif // __ARC_BROKERPLUGIN_H__
|