public class TaskStateZookeeperStore extends Object implements TaskStateStorage
Manages the state of background BackgroundTask in
a synchronized manner withing a cluster.
| Constructor and Description |
|---|
TaskStateZookeeperStore(ZookeeperConnection zookeeper) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsTask(TaskId id)
Returns whether the storage contains the given task
|
TaskState |
getState(TaskId id)
Retrieve the TaskState associated with the given ID.
|
Set<TaskState> |
getTasks(TaskStatus taskStatus,
String taskClassName,
String createdBy,
EngineID engineRunningOn,
int limit,
int offset)
This implementation will fetch all of the tasks from zookeeper and then
filer them out.
|
TaskId |
newState(TaskState task)
Creates a new task state in Zookeeper
|
Boolean |
updateState(TaskState task)
Writes a new state to Zookeeper.
|
public TaskStateZookeeperStore(ZookeeperConnection zookeeper)
public TaskId newState(TaskState task)
newState in interface TaskStateStoragetask - The new task to createpublic Boolean updateState(TaskState task)
updateState in interface TaskStateStoragetask - State to update in Zookeeperpublic TaskState getState(TaskId id)
getState in interface TaskStateStorageid - String id of task.public boolean containsTask(TaskId id)
TaskStateStoragecontainsTask in interface TaskStateStorageid - String id of taskpublic Set<TaskState> getTasks(TaskStatus taskStatus, String taskClassName, String createdBy, EngineID engineRunningOn, int limit, int offset)
getTasks in interface TaskStateStoragetaskStatus - See TaskStatus enum.taskClassName - String containing task class name. See TaskState.createdBy - String containing created by. See TaskState.engineRunningOn - Engine that the task is running on.limit - Limit the returned result set to @limit amount of entries.offset - Use in conjunction with @limit for pagination.Copyright © 2017 Grakn Labs Ltd. All rights reserved.