mock

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultJobType = "important job"
View Source
const DefaultQueue = "queue"

Variables

View Source
var NoQueueError = errors.New("Job must specify a queue")

Functions

func CleanupHandlers

func CleanupHandlers()

func NewWrappedJob

func NewWrappedJob() *wingman.InternalJob

func RegisterHandler

func RegisterHandler(name string, h HandlerSig)

func ResetLog added in v0.2.1

func ResetLog()

Types

type Backend

type Backend struct {
	LastAddedID        string
	NextJobCanceledErr error
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend() *Backend

func (*Backend) ClearJob added in v0.2.0

func (b *Backend) ClearJob(jobID string) error

func (*Backend) Close

func (b *Backend) Close() error

func (*Backend) FailJob added in v0.1.2

func (b *Backend) FailJob(job *wingman.InternalJob) error

func (*Backend) FailedJobs added in v0.2.1

func (b *Backend) FailedJobs() uint64

func (*Backend) HasProcessingJob added in v0.1.2

func (b *Backend) HasProcessingJob(processorID string) bool

func (*Backend) IncFailedJobs added in v0.2.1

func (b *Backend) IncFailedJobs()

func (*Backend) IncSuccessfulJobs added in v0.2.1

func (b *Backend) IncSuccessfulJobs()

func (*Backend) LockJob added in v0.2.3

func (b *Backend) LockJob(job *wingman.InternalJob) (wingman.LockID, error)

func (*Backend) Peek

func (b *Backend) Peek(queue string) (*wingman.InternalJob, error)

func (*Backend) PopJob added in v0.6.0

func (b *Backend) PopJob(ctx context.Context, queue string) (*wingman.InternalJob, error)

PopJob assumes that only one goroutine is waiting on the notifier

func (*Backend) ProcessJob

func (b *Backend) ProcessJob(job *wingman.InternalJob) error

func (*Backend) PushInternalJob added in v0.6.0

func (b *Backend) PushInternalJob(job *wingman.InternalJob) error

func (*Backend) PushJob

func (b *Backend) PushJob(job wingman.Job) error

func (*Backend) ReleaseJob added in v0.2.3

func (b *Backend) ReleaseJob(job *wingman.InternalJob) error

func (*Backend) Size

func (b *Backend) Size(queue string) uint64

func (*Backend) SuccessfulJobs added in v0.2.1

func (b *Backend) SuccessfulJobs() uint64

type Event added in v0.2.1

type Event map[string]any

func (Event) HasErr added in v0.2.1

func (e Event) HasErr(err error) bool

func (Event) HasField added in v0.2.1

func (e Event) HasField(key string) bool

func (Event) HasStr added in v0.2.1

func (e Event) HasStr(key, value string) bool

func (Event) HasTime added in v0.2.1

func (e Event) HasTime(key string, t time.Time, within time.Duration) bool

type HandlerSig

type HandlerSig func(context.Context, wingman.Job) error

type Job

type Job struct {
	Data                string
	HandlerOverride     string
	QueueOverride       string
	LockKeyOverride     string
	ConcurrencyOverride int
	Processed           bool
}

func NewJob

func NewJob() *Job

func (Job) Concurrency added in v0.2.3

func (j Job) Concurrency() int

func (*Job) Handle

func (j *Job) Handle(ctx context.Context) error

func (*Job) InternalJob

func (j *Job) InternalJob(queue string) *wingman.InternalJob

func (Job) LockKey added in v0.2.3

func (j Job) LockKey() string

func (Job) Queue

func (j Job) Queue() string

func (Job) TypeName

func (j Job) TypeName() string

type TestLogger added in v0.1.1

type TestLogger struct {
	zerolog.Logger
	// contains filtered or unexported fields
}
var TestLog *TestLogger

func (*TestLogger) AddEvent added in v0.2.1

func (l *TestLogger) AddEvent(event Event)

func (*TestLogger) Count added in v0.2.1

func (l *TestLogger) Count() int

func (*TestLogger) EventAtIndex added in v0.2.1

func (l *TestLogger) EventAtIndex(i int) Event

func (*TestLogger) EventByMessage added in v0.2.1

func (l *TestLogger) EventByMessage(msg string) (Event, bool)

func (*TestLogger) Fatal added in v0.1.1

func (l *TestLogger) Fatal() *zerolog.Event

func (*TestLogger) Write added in v0.2.1

func (l *TestLogger) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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