isapego commented on a change in pull request #9312:
URL: https://github.com/apache/ignite/pull/9312#discussion_r687608481
##########
File path: modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
##########
@@ -198,7 +208,214 @@ namespace ignite
return PerformTask<void, F, JobType,
TaskType>(Operation::BROADCAST, func);
}
+ /**
+ * Executes given Java task on the grid projection. If task
for given name has not been deployed yet,
+ * then 'taskName' will be used as task class name to
auto-deploy the task.
+ *
+ * @param taskName Java task name.
+ * @param taskArg Argument of task execution of type A.
+ * @return Task result of type @c R.
+ *
+ * @tparam R Type of task result.
+ * @tparam A Type of task argument.
+ */
+ template<typename R, typename A>
+ R ExecuteJavaTask(const std::string& taskName, const A&
taskArg)
+ {
+ return PerformJavaTask<R, A>(taskName, &taskArg);
+ }
+
+ /**
+ * Executes given Java task on the grid projection. If task
for given name has not been deployed yet,
+ * then 'taskName' will be used as task class name to
auto-deploy the task.
+ *
+ * @param taskName Java task name.
+ * @return Task result of type @c R.
+ *
+ * @tparam R Type of task result.
+ */
+ template<typename R>
+ R ExecuteJavaTask(const std::string& taskName)
+ {
+ return PerformJavaTask<R, int>(taskName, 0);
+ }
+
+ /**
+ * Asynchronously executes given Java task on the grid
projection. If task for given name has not been
+ * deployed yet, then 'taskName' will be used as task class
name to auto-deploy the task.
+ *
+ * @param taskName Java task name.
+ * @param taskArg Argument of task execution of type A.
+ * @return Future containing a result of type @c R.
+ *
+ * @tparam R Type of task result.
+ * @tparam A Type of task argument.
+ */
+ template<typename R, typename A>
+ Future<R> ExecuteJavaTaskAsync(const std::string& taskName,
const A& taskArg)
+ {
+ return PerformJavaTaskAsync<R, A>(taskName, &taskArg);
+ }
+
+ /**
+ * Asynchronously executes given Java task on the grid
projection. If task for given name has not been
+ * deployed yet, then 'taskName' will be used as task class
name to auto-deploy the task.
+ *
+ * @param taskName Java task name.
+ * @return Future containing a result of type @c R.
+ *
+ * @tparam R Type of task result.
+ */
+ template<typename R>
+ Future<R> ExecuteJavaTaskAsync(const std::string& taskName)
+ {
+ return PerformJavaTaskAsync<R, int>(taskName, 0);
+ }
+
private:
+ IGNITE_NO_COPY_ASSIGNMENT(ComputeImpl);
+
+ struct FutureType
+ {
+ enum Type
+ {
+ F_BYTE = 1,
+ F_BOOL = 2,
+ F_SHORT = 3,
+ F_CHAR = 4,
+ F_INT = 5,
+ F_FLOAT = 6,
+ F_LONG = 7,
+ F_DOUBLE = 8,
+ F_OBJECT = 9,
+ };
+ };
+
+ template<typename T> struct FutureTypeForType { static const
int32_t value = FutureType::F_OBJECT; };
+
+ /**
+ * @return True if projection for the compute contains
predicate.
+ */
+ bool ProjectionContainsPredicate() const;
+
+ /**
+ * @return Nodes for the compute.
+ */
+ std::vector<ignite::cluster::ClusterNode> GetNodes();
+
+ /**
+ * Write Java task using provided writer. If task for given
name has not been deployed yet,
+ * then 'taskName' will be used as task class name to
auto-deploy the task.
+ *
+ * @param taskName Java task name.
+ * @param taskArg Argument of task execution of type A.
+ * @param writer Binary writer.
+ * @return Task result of type @c R.
+ *
+ * @tparam R Type of task result.
+ * @tparam A Type of task argument.
+ */
+ template<typename A>
+ void WriteJavaTask(const std::string& taskName, const A* arg,
binary::BinaryWriterImpl& writer) {
+ writer.WriteString(taskName);
+ // Keep binary flag
Review comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]