taskqueue

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTaskAlreadyInQueue = errors.New("task already in queue")

Functions

This section is empty.

Types

type TaskItem

type TaskItem[T any] struct {
	// TaskID is the generated ID of the task item
	TaskID string

	// ID is the provided id
	ID string

	// Optional data stored with a task, needs to be serializable
	Data T
}

type TaskQueue

type TaskQueue[T any] interface {
	Enqueue(ctx context.Context, id string, data *T) (*string, error)
	Dequeue(ctx context.Context, lockTimeout, timeout time.Duration) (*TaskItem[T], error)
	Extend(ctx context.Context, taskID string) error
	Complete(ctx context.Context, taskID string) error
	Data(ctx context.Context, taskID string) (*TaskItem[T], error)
}

func New

func New[T any](rdb redis.UniversalClient, tasktype string) (TaskQueue[T], error)

Jump to

Keyboard shortcuts

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