public class TaskStateZookeeperStore extends Object implements TaskStateStorage
Manages the state of background BackgroundTask in
a synchronized manner withing a cluster. This means that all updates must be performed
by acquiring a distributed mutex so that no concurrent writes are possible.
| Constructor and Description |
|---|
TaskStateZookeeperStore(ZookeeperConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
TaskState |
getState(String id)
Retrieve the TaskState associated with the given ID.
|
Set<TaskState> |
getTasks(TaskStatus taskStatus,
String taskClassName,
String createdBy,
int limit,
int offset)
This implementation will fetch all of the tasks from zookeeper and then
filer them out.
|
String |
newState(TaskState task)
Create a new task state and store it, returning an ID to later access this task state.
|
Boolean |
updateState(TaskState task)
Used to update task state.
|
public TaskStateZookeeperStore(ZookeeperConnection connection)
public String newState(TaskState task)
TaskStateStoragenewState in interface TaskStateStoragetask - State to insert.public Boolean updateState(TaskState task)
TaskStateStorageupdateState in interface TaskStateStoragetask - State to update.public TaskState getState(String id)
getState in interface TaskStateStorageid - String id of task.public Set<TaskState> getTasks(TaskStatus taskStatus, String taskClassName, String createdBy, 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.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.