conveyor

package
v0.0.0-...-c43c499 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientContextKey = &ContextKey{"client"}
View Source
var ErrJobNotRegistered = errors.New("job not registered")
View Source
var ErrNoRegisteredJobs = errors.New("no registered jobs")
View Source
var JobContextKey = &ContextKey{"job"}

Functions

func AddClientToContext

func AddClientToContext(ctx context.Context, obj *Client) context.Context

func CurrentJob

func CurrentJob(ctx context.Context) *wire.Job

func JobContext

func JobContext(ctx context.Context, obj *wire.Job) context.Context

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func CurrentClient

func CurrentClient(ctx context.Context) *Client

func NewClient

func NewClient(cfg config.ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Enqueue

func (c *Client) Enqueue(ctx context.Context, msg proto.Message, opts ...JobOption) (*Result, error)

func (*Client) EnqueueChild

func (c *Client) EnqueueChild(ctx context.Context, msg proto.Message) (*Result, error)

func (*Client) EnqueueHeir

func (c *Client) EnqueueHeir(ctx context.Context, msg proto.Message) (*Result, error)

type ContextKey

type ContextKey struct{ Name string }

type JobOption

type JobOption func(job *wire.Job) error

func Delay

func Delay(delay time.Duration) JobOption

func RunAt

func RunAt(t time.Time) JobOption

type Result

type Result struct {
	Uuid string
}

type Worker

type Worker struct {
	ID string
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(cfg config.WorkerConfig) (*Worker, error)

func (*Worker) CallJob

func (w *Worker) CallJob(ctx context.Context, job *wire.Job) error

func (*Worker) Close

func (w *Worker) Close() error

func (*Worker) ContextFor

func (w *Worker) ContextFor(job *wire.Job) context.Context

func (*Worker) Heartbeat

func (w *Worker) Heartbeat(ctx context.Context) error

func (*Worker) Periodic

func (w *Worker) Periodic(ctx context.Context, duration time.Duration, fn func(ctx context.Context) error) error

func (*Worker) RegisterJob

func (w *Worker) RegisterJob(fn any) error

func (*Worker) RegisterJobs

func (w *Worker) RegisterJobs(fn ...any) error

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

func (*Worker) Use

func (w *Worker) Use(fn ...WorkerMiddleware)

type WorkerMiddleware

type WorkerMiddleware func(ctx context.Context, job *wire.Job) error

Directories

Path Synopsis
hub
views
templ: version: v0.2.598
templ: version: v0.2.598

Jump to

Keyboard shortcuts

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