queue

package
v0.0.0-...-444b257 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, d Driver) error

Types

type Driver

type Driver interface {
	Open(*config.QueueConfig) (Driver, error)
	Enqueue(*Job) error
	List() ([]Job, error)
	Stats() (Stats, error)
	Err() <-chan error
	ListenAndConsume() error
}

func Open

func Open(name string, cfg *config.QueueConfig) (Driver, error)

type Job

type Job struct {
	// User space input
	ID          string   `json:"id"`
	Cmd         []string `json:"cmd"`
	MaxExecTime time.Duration

	// System level input
	EnqueuedAt    time.Time
	StartedAt     time.Time
	FinishedAt    time.Time
	RetryAttempts int64
	Error         string
}

func (Job) HasFinished

func (j Job) HasFinished() bool

func (Job) IsRunning

func (j Job) IsRunning() bool

func (Job) Run

func (j Job) Run() error

func (Job) String

func (j Job) String() string

type JobStats

type JobStats struct {
	JobID     string
	ProcessID int64
}

type Stats

type Stats struct {
	Pending   int64
	Running   int64
	Succeeded int64
	Failed    int64
	Retries   int64
}

Directories

Path Synopsis
drivers
rmq

Jump to

Keyboard shortcuts

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