jobs

package
v0.0.0-...-8d9ef14 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyListFromFile = "list_from_file"
)
View Source
const (
	KeyScoreGitHubRepo = "score_githug_repo"
)

Variables

View Source
var (
	ErrImmediateReschedule = errors.New("reschedule ASAP")
	ErrDidNotReschedule    = errors.New("no need to reschedule, we are done")
)

Functions

func GetConn

func GetConn(config map[string]interface{}) (c *github.Client, err error)

func IsCrawlLimitReach

func IsCrawlLimitReach(repojob RepoJob, appconfig map[string]interface{}) error

Check if crawl limit is reached, if it does, return a customed errorcode.

func ListFromFile

func ListFromFile(logger *log.Logger, qc *cque.Client, j *cque.Job, config map[string]interface{}) error

func ScoreGitHubRepo

func ScoreGitHubRepo(logger *log.Logger, qc *cque.Client, j *cque.Job, appconfig map[string]interface{}) error

Example - we can wrap the other function

func ScoreGitHubRepoFunc

func ScoreGitHubRepoFunc(logger *log.Logger, qc *cque.Client, j *cque.Job, appconfig map[string]interface{}) error

Types

type JobFunc

type JobFunc func(logger *log.Logger, qc *que.Client, job *que.Job, appconfig map[string]interface{}) error

JobFunc should do a thing. Return either: nil => No error, move onto next job ErrImmediateReschedule => wrapper try it again immediately. ErrDidNotReschedule => wrapper will rely on queue lib to reschedule or retry. any other error => wrapper will rely on que to reschedule

type JobFuncWrapper

type JobFuncWrapper struct {
	QC        *que.Client
	Logger    *log.Logger
	F         JobFunc
	AppConfig map[string]interface{}
}

func (*JobFuncWrapper) Run

func (scw *JobFuncWrapper) Run(job *que.Job) error

type RepoJob

type RepoJob struct {
	Fullname     string
	DependedOnBy string
	Currentdepth int
}

type ScoreGitHubRepoFuncResult

type ScoreGitHubRepoFuncResult struct {
	ID                        string
	DependedOnBy              string
	Ownername                 string
	Name                      string
	URL                       string
	Dependencies              []string
	DependenciesCrawlProblems []crawl.Dependencyproblem
	RiskNotes                 map[string][]string
}

ScoreGitHubRepoFuncResult is the type of result that would return from our ScoreGithubRepo function.

func (*ScoreGitHubRepoFuncResult) String

func (sr *ScoreGitHubRepoFuncResult) String() string

For every result type, we will need to implement String() method to satisfy our Result interface.

Jump to

Keyboard shortcuts

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