#include <gridclientcomputeprojection.hpp>
Public Member Functions | |
| GridClientComputeProjectionImpl (TGridClientSharedDataPtr data, GridClientProjectionListener &prjLsnr, TGridClientNodePredicatePtr pFilter, TGridClientLoadBalancerPtr balancer, TGridThreadPoolPtr &threadPool) | |
| virtual TGridClientComputePtr | projection (const GridClientNode &node) |
| virtual TGridClientComputePtr | projection (const TGridClientNodeList &nodes) |
| virtual TGridClientComputePtr | projection (TGridClientNodePredicatePtr filter) |
| virtual TGridClientComputePtr | projection (std::function< bool(const GridClientNode &)> &filter) |
| virtual TGridClientComputePtr | projection (TGridClientNodePredicatePtr filter, TGridClientLoadBalancerPtr balancer) |
| virtual TGridClientComputePtr | projection (std::function< bool(const GridClientNode &)> &filter, TGridClientLoadBalancerPtr balancer) |
| virtual TGridClientComputePtr | projection (const TGridClientNodeList &nodes, TGridClientLoadBalancerPtr balancer) |
| virtual TGridClientLoadBalancerPtr | balancer () const |
| virtual GridClientVariant | execute (const std::string &taskName, const GridClientVariant &taskArg) |
| virtual TGridClientFutureVariant | executeAsync (const std::string &taskName, const GridClientVariant &taskArg) |
| virtual GridClientVariant | affinityExecute (const std::string &taskName, const std::string &cacheName, const GridClientVariant &affKey, const GridClientVariant &taskArg) |
| virtual TGridClientFutureVariant | affinityExecuteAsync (const std::string &taskName, const std::string &cacheName, const GridClientVariant &affKey, const GridClientVariant &taskArg) |
| virtual TGridClientNodePtr | node (const GridClientUuid &id) const |
| virtual TGridClientNodeList | nodes (TGridClientNodePredicatePtr filter) const |
| virtual TGridClientNodeList | nodes (std::function< bool(const GridClientNode &)> &filter) const |
| virtual TGridClientNodeList | nodes () const |
| virtual TGridClientNodeList | nodes (const std::vector< GridClientUuid > &ids) const |
| virtual TGridClientNodePtr | refreshNode (const GridClientUuid &id, bool includeAttrs, bool includeMetrics) |
| virtual TGridClientNodeFuturePtr | refreshNodeAsync (const GridClientUuid &id, bool includeAttrs, bool includeMetrics) |
| virtual TGridClientNodePtr | refreshNode (const std::string &ip, bool includeAttrs, bool includeMetrics) |
| virtual TGridClientNodeFuturePtr | refreshNodeAsync (const std::string &ip, bool includeAttrs, bool includeMetrics) |
| virtual TGridClientNodeList | refreshTopology (bool includeAttrs, bool includeMetrics) |
| virtual TGridClientNodeFutureList | refreshTopologyAsync (bool includeAttrs, bool includeMetrics) |
| virtual std::vector< std::string > | log (int lineFrom, int lineTo) |
| virtual TGridFutureStringList | logAsync (int lineFrom, int lineTo) |
| virtual std::vector< std::string > | log (const std::string &path, int lineFrom, int lineTo) |
| virtual TGridFutureStringList | logAsync (const std::string &path, int lineFrom, int lineTo) |
| void | invalidate () |
Protected Member Functions | |
| TGridClientComputePtr | makeProjection (TGridClientNodePredicatePtr filter, TGridClientLoadBalancerPtr balancer) |
Implementation of GridClientCompute.
| GridClientComputeProjectionImpl::GridClientComputeProjectionImpl | ( | TGridClientSharedDataPtr | data, | |
| GridClientProjectionListener & | prjLsnr, | |||
| TGridClientNodePredicatePtr | pFilter, | |||
| TGridClientLoadBalancerPtr | balancer, | |||
| TGridThreadPoolPtr & | threadPool | |||
| ) |
Constructor.
| data | Shared data. | |
| prjLsnr | Projection listener. | |
| pFilter | Node filter (may be omitted). |
| virtual GridClientVariant GridClientComputeProjectionImpl::affinityExecute | ( | const std::string & | taskName, | |
| const std::string & | cacheName, | |||
| const GridClientVariant & | affKey, | |||
| const GridClientVariant & | taskArg | |||
| ) | [virtual] |
Executes task using cache affinity key for routing. This way the task will start executing exactly on the node where this affinity key is cached.
| taskName | Task name or task class name. | |
| cacheName | Name of the cache on which affinity should be calculated. | |
| affKey | Affinity key. | |
| taskArg | Optional task argument. |
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| virtual TGridClientFutureVariant GridClientComputeProjectionImpl::affinityExecuteAsync | ( | const std::string & | taskName, | |
| const std::string & | cacheName, | |||
| const GridClientVariant & | affKey, | |||
| const GridClientVariant & | taskArg | |||
| ) | [virtual] |
Asynchronously executes task using cache affinity key for routing. This way the task will start executing exactly on the node where this affinity key is cached.
| taskName | Task name or task class name. | |
| cacheName | Name of the cache on which affinity should be calculated. | |
| affKey | Affinity key. | |
| taskArg | Optional task argument. |
| TGridClientLoadBalancerPtr GridClientComputeProjectionImpl::balancer | ( | ) | const [virtual] |
Gets balancer used by projection.
| virtual GridClientVariant GridClientComputeProjectionImpl::execute | ( | const std::string & | taskName, | |
| const GridClientVariant & | taskArg | |||
| ) | [virtual] |
Executes task.
| taskName | Task name or task class name. | |
| taskArg | Optional task argument. |
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| virtual TGridClientFutureVariant GridClientComputeProjectionImpl::executeAsync | ( | const std::string & | taskName, | |
| const GridClientVariant & | taskArg | |||
| ) | [virtual] |
Asynchronously executes task.
| taskName | Task name or task class name. | |
| taskArg | Optional task argument. |
| void GridClientComputeProjectionImpl::invalidate | ( | ) |
Invalidates this data instance. This is done by the client to indicate that is has been stopped. After this call, all interface methods will throw GridClientClosedException.
| virtual std::vector<std::string> GridClientComputeProjectionImpl::log | ( | int | lineFrom, | |
| int | lineTo | |||
| ) | [virtual] |
Gets contents of default log file (GRIDGAIN_HOME/work/log/gridgain.log).
| lineFrom | Index of line from which log is get, inclusive (starting from 0). | |
| lineTo | Index of line to which log is get, inclusive (starting from 0). |
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| virtual std::vector<std::string> GridClientComputeProjectionImpl::log | ( | const std::string & | path, | |
| int | lineFrom, | |||
| int | lineTo | |||
| ) | [virtual] |
Gets contents of custom log file.
| path | Log file path. Can be absolute or relative to GRIDGAIN_HOME. | |
| lineFrom | Index of line from which log is get, inclusive (starting from 0). | |
| lineTo | Index of line to which log is get, inclusive (starting from 0). |
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| virtual TGridFutureStringList GridClientComputeProjectionImpl::logAsync | ( | const std::string & | path, | |
| int | lineFrom, | |||
| int | lineTo | |||
| ) | [virtual] |
Asynchronously gets contents of custom log file.
| path | Log file path. Can be absolute or relative to GRIDGAIN_HOME. | |
| lineFrom | Index of line from which log is get, inclusive (starting from 0). | |
| lineTo | Index of line to which log is get, inclusive (starting from 0). |
| virtual TGridFutureStringList GridClientComputeProjectionImpl::logAsync | ( | int | lineFrom, | |
| int | lineTo | |||
| ) | [virtual] |
Asynchronously gets contents of default log file (GRIDGAIN_HOME/work/log/gridgain.log).
| lineFrom | Index of line from which log is get, inclusive (starting from 0). | |
| lineTo | Index of line to which log is get, inclusive (starting from 0). |
| TGridClientComputePtr GridClientComputeProjectionImpl::makeProjection | ( | TGridClientNodePredicatePtr | filter, | |
| TGridClientLoadBalancerPtr | balancer | |||
| ) | [protected] |
Creates subprojection based on node filter and balancer.
| filter | Node filter. | |
| balancer | Load balancer. |
| TGridClientNodePtr GridClientComputeProjectionImpl::node | ( | const GridClientUuid & | uuid | ) | const [virtual] |
Gets node with given id from most recently refreshed topology.
| id | Node ID. |
null if node with given id was not found.Gets node with given id from most recently refreshed topology.
| id | Node ID. |
null
Reimplemented from GridClientProjectionImpl.
| TGridClientNodeList GridClientComputeProjectionImpl::nodes | ( | ) | const [virtual] |
Gets all nodes in the projection.
| filter | Node filter. |
| TGridClientNodeList GridClientComputeProjectionImpl::nodes | ( | const std::vector< GridClientUuid > & | ids | ) | const [virtual] |
Gets nodes that passes the filter. If this compute instance is a projection, then only nodes that passes projection criteria will be passed to the filter.
| filter | Node filter. |
| TGridClientNodeList GridClientComputeProjectionImpl::nodes | ( | TGridClientNodePredicatePtr | pred | ) | const [virtual] |
Gets nodes that pass the filter. If this compute instance is a projection, then only nodes that pass projection criteria will be passed to the filter.
| filter | Node filter. |
Gets nodes that passes the filter. If this compute instance is a projection, then only nodes that passes projection criteria will be passed to the filter.
| filter | Node filter. |
| TGridClientNodeList GridClientComputeProjectionImpl::nodes | ( | std::function< bool(const GridClientNode &)> & | filter | ) | const [virtual] |
Gets nodes that pass the filter. If this compute instance is a projection, then only nodes that pass projection criteria will be passed to the filter.
| filter | Node filter. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | std::function< bool(const GridClientNode &)> & | filter | ) | [virtual] |
Creates a projection that will communicate only with nodes that are accepted by the passed filter.
If current projection is dynamic projection, then filter will be applied to the most relevant topology snapshot every time a node to communicate is selected. If current projection is a static projection, then resulting projection will only be restricted to nodes that were in parent projection and were accepted by the passed filter. If any of the checks fails an exception will be thrown.
| filter | Filter that will select nodes for projection. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | const GridClientNode & | node | ) | [virtual] |
Creates a projection that will communicate only with specified remote node.
If current projection is dynamic projection, then this method will check is passed node is in topology. If any filters were specified in current topology, this method will check if passed node is accepted by the filter. If current projection was restricted to any subset of nodes, this method will check if passed node is in that subset. If any of the checks fails an exception will be thrown.
| node | Single node to which this projection will be restricted. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | const TGridClientNodeList & | nodes | ) | [virtual] |
Creates a projection that will communicate only with specified remote nodes. For any particular call a node to communicate will be selected with passed balancer..
If current projection is dynamic projection, then this method will check is passed nodes are in topology. If any filters were specified in current topology, this method will check if passed nodes are accepted by the filter. If current projection was restricted to any subset of nodes, this method will check if passed nodes are in that subset (i.e. calculate the intersection of two collections). If any of the checks fails an exception will be thrown.
| nodes | Collection of nodes to which this projection will be restricted. | |
| balancer | Balancer that will select nodes in resulting projection. |
| GridClientException | If resulting projection is empty. |
Creates a projection that will communicate only with specified remote nodes. For any particular call a node to communicate will be selected with passed balancer..
If current projection is dynamic projection, then this method will check is passed nodes are in topology. If any filters were specified in current topology, this method will check if passed nodes are accepted by the filter. If current projection was restricted to any subset of nodes, this method will check if passed nodes are in that subset (i.e. calculate the intersection of two collections). If any of the checks fails an exception will be thrown.
| nodes | Collection of nodes to which this projection will be restricted. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | const TGridClientNodeList & | nodes, | |
| TGridClientLoadBalancerPtr | balancer | |||
| ) | [virtual] |
Creates a projection that will communicate only with specified remote nodes. For any particular call a node to communicate will be selected with passed balancer..
If current projection is dynamic projection, then this method will check is passed nodes are in topology. If any filters were specified in current topology, this method will check if passed nodes are accepted by the filter. If current projection was restricted to any subset of nodes, this method will check if passed nodes are in that subset (i.e. calculate the intersection of two collections). If any of the checks fails an exception will be thrown.
| nodes | Collection of nodes to which this projection will be restricted. | |
| balancer | Balancer that will select nodes in resulting projection. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | TGridClientNodePredicatePtr | filter | ) | [virtual] |
Creates a projection that will communicate only with nodes that are accepted by the passed filter.
If current projection is dynamic projection, then filter will be applied to the most relevant topology snapshot every time a node to communicate is selected. If current projection is a static projection, then resulting projection will only be restricted to nodes that were in parent projection and were accepted by the passed filter. If any of the checks fails an exception will be thrown.
| filter | Filter that will select nodes for projection. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | TGridClientNodePredicatePtr | filter, | |
| TGridClientLoadBalancerPtr | balancer | |||
| ) | [virtual] |
Creates a projection that will communicate only with nodes that are accepted by the passed filter. The balancer passed will override default balancer specified in configuration.
If current projection is dynamic projection, then filter will be applied to the most relevant topology snapshot every time a node to communicate is selected. If current projection is a static projection, then resulting projection will only be restricted to nodes that were in parent projection and were accepted by the passed filter. If any of the checks fails an exception will be thrown.
| filter | Filter that will select nodes for projection. | |
| balancer | Balancer that will select balanced node in resulting projection. |
| GridClientException | If resulting projection is empty. |
| TGridClientComputePtr GridClientComputeProjectionImpl::projection | ( | std::function< bool(const GridClientNode &)> & | filter, | |
| TGridClientLoadBalancerPtr | balancer | |||
| ) | [virtual] |
Creates a projection that will communicate only with nodes that are accepted by the passed filter. The balancer passed will override default balancer specified in configuration.
If current projection is dynamic projection, then filter will be applied to the most relevant topology snapshot every time a node to communicate is selected. If current projection is a static projection, then resulting projection will only be restricted to nodes that were in parent projection and were accepted by the passed filter. If any of the checks fails an exception will be thrown.
| filter | Filter that will select nodes for projection. | |
| balancer | Balancer that will select balanced node in resulting projection. |
| GridClientException | If resulting projection is empty. |
| TGridClientNodePtr GridClientComputeProjectionImpl::refreshNode | ( | const GridClientUuid & | id, | |
| bool | includeAttrs, | |||
| bool | includeMetrics | |||
| ) | [virtual] |
Gets node by its ID.
| id | Node ID. | |
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
null if node doesn't exist. | GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
Gets node by its ID.
| id | Node ID. | |
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
null
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| virtual TGridClientNodePtr GridClientComputeProjectionImpl::refreshNode | ( | const std::string & | ip, | |
| bool | includeAttrs, | |||
| bool | includeMetrics | |||
| ) | [virtual] |
Gets node by IP address.
| ip | IP address. | |
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
null if node doesn't exist. | GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| TGridClientNodeFuturePtr GridClientComputeProjectionImpl::refreshNodeAsync | ( | const GridClientUuid & | id, | |
| bool | includeAttrs, | |||
| bool | includeMetrics | |||
| ) | [virtual] |
Asynchronously gets node by its ID.
| id | Node ID. | |
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
| virtual TGridClientNodeFuturePtr GridClientComputeProjectionImpl::refreshNodeAsync | ( | const std::string & | ip, | |
| bool | includeAttrs, | |||
| bool | includeMetrics | |||
| ) | [virtual] |
Asynchronously gets node by IP address.
| ip | IP address. | |
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
| TGridClientNodeList GridClientComputeProjectionImpl::refreshTopology | ( | bool | includeAttrs, | |
| bool | includeMetrics | |||
| ) | [virtual] |
Gets current topology.
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
| GridClientException | In case of error. | |
| GridServerUnreachableException | If none of the servers can be reached. | |
| GridClientClosedException | If client was closed manually. |
| TGridClientNodeFutureList GridClientComputeProjectionImpl::refreshTopologyAsync | ( | bool | includeAttrs, | |
| bool | includeMetrics | |||
| ) | [virtual] |
Asynchronously gets current topology.
| includeAttrs | Whether to include node attributes. | |
| includeMetrics | Whether to include node metrics. |
1.7.1