Documentation ¶
Index ¶
- Constants
- type RedisFacade
- func (f RedisFacade) GetRunMetadata() (model.RunMetadata, error, RedisFacadeErrorType)
- func (f RedisFacade) GetTaskMetadata(key string) model.TaskMetadata
- func (f RedisFacade) GetTaskStatus(key string) string
- func (f RedisFacade) PopTask() (empty bool, key string)
- func (f RedisFacade) PushTask(key string)
- func (f RedisFacade) SetRunMetadata(runid string, taskcount int)
- func (f RedisFacade) SetTaskAsCompleteWithErrorResult(task *model.TaskMetadata)
- func (f RedisFacade) SetTaskAsCompleteWithFailedResult(task *model.TaskMetadata)
- func (f RedisFacade) SetTaskAsCompleteWithPassedResult(task *model.TaskMetadata)
- func (f RedisFacade) SetTaskAsProcessing(task *model.TaskMetadata)
- func (f RedisFacade) SetTaskMetadata(key string, task model.Task)
- func (f RedisFacade) UpdateRunMetadataTaskCount(remaining int, finished int)
- type RedisFacadeErrorType
- type RunMetadataKeys
- type TaskMetadataKeys
Constants ¶
const RUN_METADATA = "runmeta"
RUN_METADATA is a Redis Hash (object) that holds metadata about the run
const TASKRESULT_ERROR = "error"
const TASKRESULT_FAILED = "failed"
const TASKRESULT_PASSED = "passed"
const TASKRESULT_UNKNOWN = "unknown"
const TASKSTATUS_COMPLETE = "complete"
const TASKSTATUS_PROCESSING = "processing"
const TASKSTATUS_WAITING = "waiting"
const TASK_QUEUE = "taskqueue"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisFacade ¶
type RedisFacade struct {
// contains filtered or unexported fields
}
RedisFacade represents a REDIS DB connection and supporting functions for que/dequ workqueue tasks.
func NewFacade ¶
func NewFacade(context context.Context, host string, port string) RedisFacade
NewFacade will create a new facade to the REDIS DB
func (RedisFacade) GetRunMetadata ¶
func (f RedisFacade) GetRunMetadata() (model.RunMetadata, error, RedisFacadeErrorType)
GetRunMetadata will return up to date information about the run
func (RedisFacade) GetTaskMetadata ¶
func (f RedisFacade) GetTaskMetadata(key string) model.TaskMetadata
GetTaskMetadata will return all tasks metadata for a task
func (RedisFacade) GetTaskStatus ¶
func (f RedisFacade) GetTaskStatus(key string) string
GetTaskStatus will return a tasks status (TASKSTATUS_WAITING, TASKSTATUS_PROCESSING, or TASKSTATUS_COMPLETE )
func (RedisFacade) PopTask ¶
func (f RedisFacade) PopTask() (empty bool, key string)
PopTask will pop (RPOP) a task key from the queue
func (RedisFacade) PushTask ¶
func (f RedisFacade) PushTask(key string)
PushTask will push (LPUSH) a task key to the queue
func (RedisFacade) SetRunMetadata ¶
func (f RedisFacade) SetRunMetadata(runid string, taskcount int)
SetRunMetadata will set (HMSET) the runmeta hash object
func (RedisFacade) SetTaskAsCompleteWithErrorResult ¶
func (f RedisFacade) SetTaskAsCompleteWithErrorResult(task *model.TaskMetadata)
SetTaskAsCompleteWithErrorResult will denote the current time and mark the task as TASKSTATUS_COMPLETE with TASKRESULT_ERROR
func (RedisFacade) SetTaskAsCompleteWithFailedResult ¶
func (f RedisFacade) SetTaskAsCompleteWithFailedResult(task *model.TaskMetadata)
SetTaskAsCompleteWithFailedResult will denote the current time and mark the task as TASKSTATUS_COMPLETE with TASKRESULT_FAILED
func (RedisFacade) SetTaskAsCompleteWithPassedResult ¶
func (f RedisFacade) SetTaskAsCompleteWithPassedResult(task *model.TaskMetadata)
SetTaskAsCompleteWithPassedResult will denote the current time and mark the task as TASKSTATUS_COMPLETE with TASKRESULT_PASSED
func (RedisFacade) SetTaskAsProcessing ¶
func (f RedisFacade) SetTaskAsProcessing(task *model.TaskMetadata)
SetTaskAsProcessing will denote the current time and mark the task as TASKSTATUS_PROCESSING
func (RedisFacade) SetTaskMetadata ¶
func (f RedisFacade) SetTaskMetadata(key string, task model.Task)
SetTaskMetadata will set (HMSET) the meta hash object for a task and return the hash key
func (RedisFacade) UpdateRunMetadataTaskCount ¶
func (f RedisFacade) UpdateRunMetadataTaskCount(remaining int, finished int)
UpdateRunMetadataTaskCount will set the number of tasks accordingly. This function will also set the "finished" flag accordingly, once all tasks are noted as finished.
type RedisFacadeErrorType ¶
type RedisFacadeErrorType int
----------------------
const ( None RedisFacadeErrorType = iota TcpHostErr TcpCxErr RedisNil )
type RunMetadataKeys ¶
type RunMetadataKeys struct { RunID string TasksRemaining string TasksFinished string Finished string }
func GetRunMetadataKeys ¶
func GetRunMetadataKeys() RunMetadataKeys
type TaskMetadataKeys ¶
type TaskMetadataKeys struct { Key string Spec string Viewport string Browser string Status string Result string StartTime string Duration string DurationString string }
func GetTaskMetadataKeys ¶
func GetTaskMetadataKeys() TaskMetadataKeys