Public Member Functions | Protected Member Functions

GridClientComputeProjectionImpl Class Reference

#include <gridclientcomputeprojection.hpp>

Inheritance diagram for GridClientComputeProjectionImpl:
GridClientCompute GridClientProjectionImpl

List of all members.

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)

Detailed Description

Implementation of GridClientCompute.


Constructor & Destructor Documentation

GridClientComputeProjectionImpl::GridClientComputeProjectionImpl ( TGridClientSharedDataPtr  data,
GridClientProjectionListener &  prjLsnr,
TGridClientNodePredicatePtr  pFilter,
TGridClientLoadBalancerPtr  balancer,
TGridThreadPoolPtr &  threadPool 
)

Constructor.

Parameters:
data Shared data.
prjLsnr Projection listener.
pFilter Node filter (may be omitted).

Member Function Documentation

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.

Parameters:
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.
Returns:
Task execution result.
Exceptions:
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.

Parameters:
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.
Returns:
Future.
TGridClientLoadBalancerPtr GridClientComputeProjectionImpl::balancer (  )  const [virtual]

Gets balancer used by projection.

Returns:
Instance of GridClientLoadBalancer.
virtual GridClientVariant GridClientComputeProjectionImpl::execute ( const std::string &  taskName,
const GridClientVariant &  taskArg 
) [virtual]

Executes task.

Parameters:
taskName Task name or task class name.
taskArg Optional task argument.
Returns:
Task execution result.
Exceptions:
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.

Parameters:
taskName Task name or task class name.
taskArg Optional task argument.
Returns:
Future.
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).

Parameters:
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).
Returns:
Log contents.
Exceptions:
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.

Parameters:
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).
Returns:
Log contents.
Exceptions:
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.

Parameters:
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).
Returns:
Future.
virtual TGridFutureStringList GridClientComputeProjectionImpl::logAsync ( int  lineFrom,
int  lineTo 
) [virtual]

Asynchronously gets contents of default log file (GRIDGAIN_HOME/work/log/gridgain.log).

Parameters:
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).
Returns:
Future.
TGridClientComputePtr GridClientComputeProjectionImpl::makeProjection ( TGridClientNodePredicatePtr  filter,
TGridClientLoadBalancerPtr  balancer 
) [protected]

Creates subprojection based on node filter and balancer.

Parameters:
filter Node filter.
balancer Load balancer.
TGridClientNodePtr GridClientComputeProjectionImpl::node ( const GridClientUuid &  uuid  )  const [virtual]

Gets node with given id from most recently refreshed topology.

Parameters:
id Node ID.
Returns:
Node for given ID or null if node with given id was not found.

Gets node with given id from most recently refreshed topology.

Parameters:
id Node ID.
Returns:
Node for given ID or
 null 
if node with given id was not found.

Reimplemented from GridClientProjectionImpl.

TGridClientNodeList GridClientComputeProjectionImpl::nodes (  )  const [virtual]

Gets all nodes in the projection.

Parameters:
filter Node filter.
Returns:
Collection of nodes that satisfy provided 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.

Parameters:
filter Node filter.
Returns:
Collection of nodes that satisfy provided 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.

Parameters:
filter Node filter.
Returns:
Collection of nodes that satisfy provided 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.

Parameters:
filter Node filter.
Returns:
Collection of nodes that satisfy provided 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.

Parameters:
filter Node filter.
Returns:
Collection of nodes that satisfy provided 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.

Parameters:
filter Filter that will select nodes for projection.
Returns:
Resulting projection (static or dynamic, depending in parent projection type).
Exceptions:
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.

Parameters:
node Single node to which this projection will be restricted.
Returns:
Resulting static projection that is bound to a given node.
Exceptions:
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.

Parameters:
nodes Collection of nodes to which this projection will be restricted.
balancer Balancer that will select nodes in resulting projection.
Returns:
Resulting static projection that is bound to a given nodes.
Exceptions:
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.

Parameters:
nodes Collection of nodes to which this projection will be restricted.
Returns:
Resulting static projection that is bound to a given nodes.
Exceptions:
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.

Parameters:
nodes Collection of nodes to which this projection will be restricted.
balancer Balancer that will select nodes in resulting projection.
Returns:
Resulting static projection that is bound to a given nodes.
Exceptions:
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.

Parameters:
filter Filter that will select nodes for projection.
Returns:
Resulting projection (static or dynamic, depending in parent projection type).
Exceptions:
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.

Parameters:
filter Filter that will select nodes for projection.
balancer Balancer that will select balanced node in resulting projection.
Returns:
Resulting projection (static or dynamic, depending in parent projection type).
Exceptions:
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.

Parameters:
filter Filter that will select nodes for projection.
balancer Balancer that will select balanced node in resulting projection.
Returns:
Resulting projection (static or dynamic, depending in parent projection type).
Exceptions:
GridClientException If resulting projection is empty.
TGridClientNodePtr GridClientComputeProjectionImpl::refreshNode ( const GridClientUuid &  id,
bool  includeAttrs,
bool  includeMetrics 
) [virtual]

Gets node by its ID.

Parameters:
id Node ID.
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Node descriptor or null if node doesn't exist.
Exceptions:
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.

Parameters:
id Node ID.
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Node descriptor or
 null 
if node doesn't exist.
Exceptions:
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.

Parameters:
ip IP address.
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Node descriptor or null if node doesn't exist.
Exceptions:
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.

Parameters:
id Node ID.
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Future.
virtual TGridClientNodeFuturePtr GridClientComputeProjectionImpl::refreshNodeAsync ( const std::string &  ip,
bool  includeAttrs,
bool  includeMetrics 
) [virtual]

Asynchronously gets node by IP address.

Parameters:
ip IP address.
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Future.
TGridClientNodeList GridClientComputeProjectionImpl::refreshTopology ( bool  includeAttrs,
bool  includeMetrics 
) [virtual]

Gets current topology.

Parameters:
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Node descriptors.
Exceptions:
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.

Parameters:
includeAttrs Whether to include node attributes.
includeMetrics Whether to include node metrics.
Returns:
Future.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends