public class ActionDBAccessorImpl extends Object implements ActionDBAccessor
Constructor and Description |
---|
ActionDBAccessorImpl(long cacheLimit) |
Modifier and Type | Method and Description |
---|---|
void |
abortHostRole(String host,
long requestId,
long stageId,
String role)
Mark the task as to have been aborted
|
void |
abortHostRole(String host,
long requestId,
long stageId,
String role,
String reason)
Mark the task as to have been aborted.
|
void |
abortOperation(long requestId)
Abort all outstanding operations associated with the given request
|
void |
endRequest(long requestId) |
void |
endRequestIfCompleted(long requestId) |
List<Stage> |
getAllStages(long requestId)
Get all stages associated with a single request id
|
List<HostRoleCommand> |
getAllTasksByRequestIds(Collection<Long> requestIds)
Given a list of request ids, get all the tasks that belong to these requests
|
long |
getLastPersistedRequestIdWhenInitialized()
Return the last persisted Request ID as seen when the DBAccessor object
was initialized.
|
Request |
getRequest(long requestId)
Get request object by id
|
Map<Long,String> |
getRequestContext(List<Long> requestIds)
Gets request contexts associated with the list of request id
|
String |
getRequestContext(long requestId)
Gets the request context associated with the request id
|
List<Long> |
getRequestIds()
Get all requests
|
List<Request> |
getRequests(Collection<Long> requestIds)
Gets request objects by ids
|
List<Long> |
getRequestsByStatus(RequestStatus status)
Gets request id of request that are in the specified status
|
List<HostRoleCommand> |
getRequestTasks(long requestId)
Given a request id, get all the tasks that belong to this request
|
Stage |
getStage(String actionId)
Given an action id of the form requestId-stageId, retrieve the Stage
|
List<Stage> |
getStagesByHostRoleStatus(Set<HostRoleStatus> statuses)
Get all stages that contain tasks with specified host role statuses
|
List<Stage> |
getStagesInProgress()
Returns all the pending stages, including queued and not-queued.
|
HostRoleCommand |
getTask(long taskId)
Gets the host role command corresponding to the task id
|
List<HostRoleCommand> |
getTasks(Collection<Long> taskIds)
Given a list of task ids, get all the host role commands
|
List<HostRoleCommand> |
getTasksByRequestAndTaskIds(Collection<Long> requestIds,
Collection<Long> taskIds)
Get a list of host role commands where the request id belongs to the input requestIds and
the task id belongs to the input taskIds
|
void |
hostRoleScheduled(Stage s,
String hostname,
String roleStr)
Updates scheduled stage.
|
void |
persistActions(Request request)
Persists all tasks for a given request
|
void |
setSourceScheduleForRequest(long requestId,
long scheduleId)
Updates request with link to source schedule
|
void |
startRequest(long requestId) |
void |
timeoutHostRole(String host,
long requestId,
long stageId,
String role)
Mark the task as to have timed out
|
void |
updateHostRoleState(String hostname,
long requestId,
long stageId,
String role,
CommandReport report)
For the given host, update all the tasks based on the command report
|
void |
updateHostRoleStates(Collection<CommandReport> reports)
Update tasks according to command reports
|
public Stage getStage(String actionId)
ActionDBAccessor
getStage
in interface ActionDBAccessor
public List<Stage> getAllStages(long requestId)
ActionDBAccessor
getAllStages
in interface ActionDBAccessor
public Request getRequest(long requestId)
ActionDBAccessor
getRequest
in interface ActionDBAccessor
public void abortOperation(long requestId)
ActionDBAccessor
abortOperation
in interface ActionDBAccessor
public void timeoutHostRole(String host, long requestId, long stageId, String role)
ActionDBAccessor
timeoutHostRole
in interface ActionDBAccessor
public List<Stage> getStagesInProgress()
ActionDBAccessor
getStagesInProgress
in interface ActionDBAccessor
public void persistActions(Request request)
ActionDBAccessor
persistActions
in interface ActionDBAccessor
request
- request objectpublic void startRequest(long requestId)
startRequest
in interface ActionDBAccessor
public void endRequest(long requestId)
endRequest
in interface ActionDBAccessor
public void endRequestIfCompleted(long requestId)
public void setSourceScheduleForRequest(long requestId, long scheduleId)
ActionDBAccessor
setSourceScheduleForRequest
in interface ActionDBAccessor
public void updateHostRoleStates(Collection<CommandReport> reports)
ActionDBAccessor
updateHostRoleStates
in interface ActionDBAccessor
public void updateHostRoleState(String hostname, long requestId, long stageId, String role, CommandReport report)
ActionDBAccessor
updateHostRoleState
in interface ActionDBAccessor
public void abortHostRole(String host, long requestId, long stageId, String role)
ActionDBAccessor
abortHostRole
in interface ActionDBAccessor
public void abortHostRole(String host, long requestId, long stageId, String role, String reason)
ActionDBAccessor
abortHostRole
in interface ActionDBAccessor
public long getLastPersistedRequestIdWhenInitialized()
ActionDBAccessor
getLastPersistedRequestIdWhenInitialized
in interface ActionDBAccessor
public void hostRoleScheduled(Stage s, String hostname, String roleStr)
ActionDBAccessor
hostRoleScheduled
in interface ActionDBAccessor
public List<HostRoleCommand> getRequestTasks(long requestId)
ActionDBAccessor
getRequestTasks
in interface ActionDBAccessor
public List<HostRoleCommand> getAllTasksByRequestIds(Collection<Long> requestIds)
ActionDBAccessor
getAllTasksByRequestIds
in interface ActionDBAccessor
public List<HostRoleCommand> getTasksByRequestAndTaskIds(Collection<Long> requestIds, Collection<Long> taskIds)
ActionDBAccessor
getTasksByRequestAndTaskIds
in interface ActionDBAccessor
public List<HostRoleCommand> getTasks(Collection<Long> taskIds)
ActionDBAccessor
getTasks
in interface ActionDBAccessor
public List<Stage> getStagesByHostRoleStatus(Set<HostRoleStatus> statuses)
ActionDBAccessor
getStagesByHostRoleStatus
in interface ActionDBAccessor
public List<Long> getRequestIds()
ActionDBAccessor
getRequestIds
in interface ActionDBAccessor
public HostRoleCommand getTask(long taskId)
ActionDBAccessor
getTask
in interface ActionDBAccessor
public List<Long> getRequestsByStatus(RequestStatus status)
ActionDBAccessor
getRequestsByStatus
in interface ActionDBAccessor
public Map<Long,String> getRequestContext(List<Long> requestIds)
ActionDBAccessor
getRequestContext
in interface ActionDBAccessor
public String getRequestContext(long requestId)
ActionDBAccessor
getRequestContext
in interface ActionDBAccessor
public List<Request> getRequests(Collection<Long> requestIds)
ActionDBAccessor
getRequests
in interface ActionDBAccessor
Copyright © 2015. All rights reserved.