Module org.elasticsearch.server
Package org.elasticsearch.persistent
Class PersistentTasks.Builder<T extends PersistentTasks.Builder<T>>
java.lang.Object
org.elasticsearch.persistent.PersistentTasks.Builder<T>
- Direct Known Subclasses:
ClusterPersistentTasksCustomMetadata.Builder
,PersistentTasksCustomMetadata.Builder
- Enclosing interface:
PersistentTasks
public abstract static class PersistentTasks.Builder<T extends PersistentTasks.Builder<T>>
extends Object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Builder()
protected
Builder
(PersistentTasks tasksInProgress) -
Method Summary
Modifier and TypeMethodDescription<Params extends PersistentTaskParams>
TaddTask
(String taskId, String taskName, Params params, PersistentTasksCustomMetadata.Assignment assignment) Adds a new task to the builderabstract PersistentTasks
build()
final ClusterState
buildAndUpdate
(ClusterState currentState, ProjectId projectId) protected abstract ClusterState
doBuildAndUpdate
(ClusterState currentState, ProjectId projectId) long
boolean
Checks if the task is currently present in the listboolean
Checks if the task is currently present in the list and has the right allocation idboolean
Returns true if any the task list was changed since the builder was createdreassignTask
(String taskId, PersistentTasksCustomMetadata.Assignment assignment) Reassigns the task to another noderemoveTask
(String taskId) Removes the taskprotected T
setLastAllocationId
(long currentId) protected T
setLastAllocationId
(ClusterState clusterState) protected <Params extends PersistentTaskParams>
TsetTasks
(List<PersistentTasks.TaskBuilder<Params>> tasks) updateTaskState
(String taskId, PersistentTaskState taskState) Updates the task state
-
Constructor Details
-
Builder
protected Builder() -
Builder
-
-
Method Details
-
getLastAllocationId
public long getLastAllocationId() -
setLastAllocationId
-
setLastAllocationId
-
setTasks
protected <Params extends PersistentTaskParams> T setTasks(List<PersistentTasks.TaskBuilder<Params>> tasks) -
addTask
public <Params extends PersistentTaskParams> T addTask(String taskId, String taskName, Params params, PersistentTasksCustomMetadata.Assignment assignment) Adds a new task to the builderAfter the task is added its id can be found by calling {
getLastAllocationId()
} method. -
reassignTask
Reassigns the task to another node -
updateTaskState
Updates the task state -
removeTask
Removes the task -
hasTask
Checks if the task is currently present in the list -
hasTask
Checks if the task is currently present in the list and has the right allocation id -
isChanged
public boolean isChanged()Returns true if any the task list was changed since the builder was created -
build
-
buildAndUpdate
-
doBuildAndUpdate
-