jobs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package jobs exposes the job engine and defines the job types used by seer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseJobContext

type BaseJobContext struct {
	RiotAPI riot.API
	Store   store.Store
}

BaseJobContext denotes dependencies common to most jobs

type Engine

type Engine interface {
	Start()
	Close()
}

Engine is the contract for managing job execution

func NewJobsEngine

func NewJobsEngine(l *zap.Logger, app string, redisPool *redis.Pool, b *BaseJobContext) Engine

NewJobsEngine instantiates a new job runn

type Job

type Job interface {
	Name() string
	Params() map[string]interface{}
	Unique() bool
}

Job is the interface jobs should fulfill

func NewMatchesSyncJob

func NewMatchesSyncJob(teamID, requestID string) Job

NewMatchesSyncJob instantiates a runnable job for syncing a team's latest matches

func NewTeamAnalyticsJob

func NewTeamAnalyticsJob(teamID, requestID string) Job

NewTeamAnalyticsJob instantiates a runnable job for syncing a team's latest matches

type Queue

type Queue interface {
	Queue(j Job) (string, error)
}

Queue is an interface for accepting jobs in a queue

func NewJobQueue

func NewJobQueue(log *zap.Logger, app string, redisPool *redis.Pool) Queue

NewJobQueue instantiates a new queue

type Status

type Status string

Status indicates the state of a job

const (
	// StatusQueued means job has been queued
	StatusQueued Status = "queued"
	// StatusRunning means the job is active
	StatusRunning Status = "running"
	// StatusRetrying means the job is scheduled for a retry
	StatusRetrying Status = "retrying"
	// StatusFailed means the job was unable to run successfully
	StatusFailed Status = "failed"
	// StatusDone means the job was able to run to completion
	StatusDone Status = "done"
)

Jump to

Keyboard shortcuts

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