redisfacade

package
v0.0.0-...-d00d672 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const RUN_METADATA = "runmeta"

RUN_METADATA is a Redis Hash (object) that holds metadata about the run

View Source
const TASKRESULT_ERROR = "error"
View Source
const TASKRESULT_FAILED = "failed"
View Source
const TASKRESULT_PASSED = "passed"
View Source
const TASKRESULT_UNKNOWN = "unknown"
View Source
const TASKSTATUS_COMPLETE = "complete"
View Source
const TASKSTATUS_PROCESSING = "processing"
View Source
const TASKSTATUS_WAITING = "waiting"
View Source
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL