job

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(repo Repository) core.JobService

Types

type Handler

type Handler interface {
	List(c echo.Context) error
	Create(c echo.Context) error
	Cancel(c echo.Context) error
}

func NewHandler

func NewHandler(service core.JobService) Handler

type Job

type Job struct {
	Type      string    `json:"type"`
	Payload   string    `json:"payload"`
	Scheduled time.Time `json:"scheduled"`
}

type Reactor

type Reactor interface {
	Start(ctx context.Context)
}

func NewReactor

func NewReactor(
	store core.StoreService,
	job core.JobService,
) Reactor

Newreactor creates a new reactor

type Repository

type Repository interface {
	List(ctx context.Context, authorID string) ([]core.Job, error)
	Enqueue(ctx context.Context, author, typ, payload string, scheduled time.Time) (core.Job, error)
	Dequeue(ctx context.Context) (*core.Job, error)
	Complete(ctx context.Context, id, status, result string) (core.Job, error)
	Cancel(ctx context.Context, id string) (core.Job, error)
	Clean(ctx context.Context, olderThan time.Time) ([]core.Job, error)
}

func NewRepository

func NewRepository(db *gorm.DB) Repository

Jump to

Keyboard shortcuts

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