public interface StateStorage
| Modifier and Type | Method and Description |
|---|---|
TaskState |
getState(String id)
This is a copy of the internal TaskState object.
|
Set<javafx.util.Pair<String,TaskState>> |
getTasks(TaskStatus taskStatus,
String taskClassName,
String createdBy,
int limit,
int offset)
Return a Set of Pairs of tasks that match any of the criteria.
|
String |
newState(String taskName,
String createdBy,
Date runAt,
Boolean recurring,
long interval,
org.json.JSONObject configuration)
Create a new task state and store it, returning an ID to later access this task state.
|
void |
updateState(String id,
TaskStatus status,
String statusChangeBy,
String executingHostname,
Throwable failure,
String checkpoint,
org.json.JSONObject configuration)
Used to update task state.
|
String newState(String taskName, String createdBy, Date runAt, Boolean recurring, long interval, org.json.JSONObject configuration)
taskName - String class name of object implementing the BackgroundTask interface. This must not be null.createdBy - String of who is creating this new state. This must not be null.runAt - Date when should this task be executed. This must not be null.recurring - Boolean marking if this task should be run again after it has finished executing successfully.
This must not be null.interval - If a task is marked as recurring, this represents the time delay between the next executing of this task.
This must not be null.configuration - A JSONObject instance containing configuration and optionally data for the task. This is an
optional parameter and may be set to null to not pass any configuration (task.start() will
get an initialised but empty JSONObject).void updateState(String id, TaskStatus status, String statusChangeBy, String executingHostname, Throwable failure, String checkpoint, org.json.JSONObject configuration)
id - ID of task to update, this must not be null.status - New status of task, may be null.statusChangeBy - String identifying caller, may be null.executingHostname - String hostname of engine instance scheduling/executing this task. May be null.failure - Throwable to store any exceptions that occurred during executing. May be null.checkpoint - String to store task checkpoint, may be null.TaskState getState(String id)
id - String id of task.Set<javafx.util.Pair<String,TaskState>> getTasks(TaskStatus taskStatus, String taskClassName, String createdBy, int limit, int offset)
taskStatus - 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 © 2016 Grakn Labs Ltd. All rights reserved.