gianm commented on code in PR #14581:
URL: https://github.com/apache/druid/pull/14581#discussion_r1272480260


##########
server/src/main/java/org/apache/druid/rpc/indexing/OverlordClient.java:
##########
@@ -43,17 +52,129 @@
  */
 public interface OverlordClient
 {
+  /**
+   * Contact the Overlord that we believe to be the leader, and return the 
result of its
+   * {@code /druid/indexer/v1/leader} API. This may be a different Overlord 
server than the one we contacted, if
+   * a leader change happened since the last time we updated our sense of who 
the leader is.
+   */
+  ListenableFuture<URI> findCurrentLeader();
+
+  /**
+   * Run a task with the provided ID and payload. The payload must be 
convertible by an
+   * {@link com.fasterxml.jackson.databind.ObjectMapper} into a Task object. 
This method does not take Task objects
+   * directly, because Task is in the indexing-service package.
+   *
+   * @param taskId     task ID
+   * @param taskObject task payload
+   */
   ListenableFuture<Void> runTask(String taskId, Object taskObject);
 
+  /**
+   * Run a "kill" task for a particular datasource and interval. Shortcut to 
{@link #runTask(String, Object)}.
+   *
+   * @param idPrefix   Descriptive prefix to include at the start of task IDs
+   * @param dataSource Datasource to kill
+   * @param interval   Interval to kill
+   */
+  default ListenableFuture<Void> runKillTask(String idPrefix, String 
dataSource, Interval interval)
+  {
+    final String taskId = IdUtils.newTaskId(idPrefix, 
ClientKillUnusedSegmentsTaskQuery.TYPE, dataSource, interval);
+    final ClientTaskQuery taskQuery = new 
ClientKillUnusedSegmentsTaskQuery(taskId, dataSource, interval, false);
+    return runTask(taskId, taskQuery);
+  }
+
+  /**
+   * Cancel a task.
+   *
+   * @param taskId task ID
+   */
   ListenableFuture<Void> cancelTask(String taskId);
 
+  /**
+   * Return {@link TaskStatusPlus} for all tasks matching a set of optional 
search parameters.
+   *
+   * @param state             task state: may be "pending", "waiting", 
"running", or "complete"
+   * @param dataSource        datasource
+   * @param maxCompletedTasks maximum number of completed tasks to return. 
Does not affect other kinds of tasks

Review Comment:
   Yeah I agree this API is a little weird. That being said, it does match the 
server-side API. (Which is also a little weird.) Just now, I added a bunch of 
javadocs clarifying the behavior of `maxCompletedTasks`. That's a start, I 
think.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to