storage

package
v0.0.0-...-50eea52 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ErrStorage = errors.Sentinel("storage error")

Variables

This section is empty.

Functions

This section is empty.

Types

type JobsRunning

type JobsRunning map[string]int

type JobsToRun

type JobsToRun interface {
	Next() (*jw.Job, error)
}

type SelectNextJob

type SelectNextJob func(jr JobsRunning, jtr JobsToRun) (*jw.Job, error)

type State

type State struct {
	Jobs struct {
		Todo      int `json:"todo"`
		Pending   int `json:"pending"`
		Running   int `json:"running"`
		Succeeded int `json:"succeeded"`
		Failed    int `json:"failed"`
		Total     int `json:"total"`
	}
	Workflows struct {
		Running   int `json:"running"`
		Succeeded int `json:"succeeded"`
		Failed    int `json:"failed"`
		Total     int `json:"total"`
	}
}

type Storage

type Storage interface {
	ValidateJob(job *jw.Job) error
	InsertJob(job *jw.Job) (bool, error)
	UpdateJob(job *jw.Job) error
	NotifyJob(id string, data interface{}) error
	SetJobPriority(id string, priority jw.Priority) error
	SetJobRunAfter(id string, duration time.Duration) error

	NextJob(namespace string, fn SelectNextJob) (*jw.Job, error)

	ValidateWorkflow(wf *jw.Workflow) error
	InsertWorkflow(wf *jw.Workflow, job *jw.Job) error
	Workflow(id string, mustExist bool) (*jw.Workflow, error)
	UpdateWorkflow(wf *jw.Workflow, job, nextJob *jw.Job) error
	SetWorkflowPriority(id string, priority jw.Priority) error

	Clean() error
	State() (*State, error)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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