public class MetadataTaskStorage extends Object implements TaskStorage
Constructor and Description |
---|
MetadataTaskStorage(MetadataStorageConnector metadataStorageConnector,
TaskStorageConfig config,
MetadataStorageActionHandlerFactory factory) |
Modifier and Type | Method and Description |
---|---|
<T> void |
addAuditLog(Task task,
TaskAction<T> taskAction)
Add an action taken by a task to the audit log.
|
void |
addLock(String taskid,
TaskLock taskLock)
Persists lock state in the storage facility.
|
List<Task> |
getActiveTasks()
Returns a list of currently running or pending tasks as stored in the storage facility.
|
List<TaskAction> |
getAuditLogs(String taskId)
Returns all actions taken by a task.
|
List<TaskLock> |
getLocks(String taskid)
Returns a list of locks for a particular task.
|
List<TaskStatus> |
getRecentlyFinishedTaskStatuses()
Returns a list of recently finished task statuses as stored in the storage facility.
|
com.google.common.base.Optional<TaskStatus> |
getStatus(String taskId)
Returns task status as stored in the storage facility.
|
com.google.common.base.Optional<Task> |
getTask(String taskId)
Returns task as stored in the storage facility.
|
void |
insert(Task task,
TaskStatus status)
Adds a task to the storage facility with a particular status.
|
void |
removeLock(String taskid,
TaskLock taskLockToRemove)
Removes lock state from the storage facility.
|
void |
setStatus(TaskStatus status)
Persists task status in the storage facility.
|
void |
start() |
void |
stop() |
@Inject public MetadataTaskStorage(MetadataStorageConnector metadataStorageConnector, TaskStorageConfig config, MetadataStorageActionHandlerFactory factory)
public void start()
public void stop()
public void insert(Task task, TaskStatus status) throws EntryExistsException
TaskStorage
insert
in interface TaskStorage
task
- task to addstatus
- task statusEntryExistsException
- if the task ID already existspublic void setStatus(TaskStatus status)
TaskStorage
setStatus
in interface TaskStorage
status
- task statuspublic com.google.common.base.Optional<Task> getTask(String taskId)
TaskStorage
TaskStorage.getStatus(java.lang.String)
. Expect that in the future.getTask
in interface TaskStorage
taskId
- task IDpublic com.google.common.base.Optional<TaskStatus> getStatus(String taskId)
TaskStorage
getStatus
in interface TaskStorage
taskId
- task IDpublic List<Task> getActiveTasks()
TaskStorage
getActiveTasks
in interface TaskStorage
public List<TaskStatus> getRecentlyFinishedTaskStatuses()
TaskStorage
getRecentlyFinishedTaskStatuses
in interface TaskStorage
public void addLock(String taskid, TaskLock taskLock)
TaskStorage
addLock
in interface TaskStorage
taskid
- task IDtaskLock
- lock statepublic void removeLock(String taskid, TaskLock taskLockToRemove)
TaskStorage
removeLock
in interface TaskStorage
taskid
- task IDtaskLockToRemove
- lock statepublic List<TaskLock> getLocks(String taskid)
TaskStorage
getLocks
in interface TaskStorage
taskid
- task IDpublic <T> void addAuditLog(Task task, TaskAction<T> taskAction)
TaskStorage
addAuditLog
in interface TaskStorage
T
- task action return typetask
- task to record action fortaskAction
- task action to recordpublic List<TaskAction> getAuditLogs(String taskId)
TaskStorage
getAuditLogs
in interface TaskStorage
taskId
- task IDCopyright © 2011–2015. All rights reserved.