worker

package
v0.0.0-...-84646e9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: CC0-1.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoBasePathSet      = JobError{"empty BBBasePath: Must be set"}
	ErrParentJobNotFound  = JobError{"parent job not found"}
	ErrParentJobCancelled = JobError{"parent job cancelled"}
	ErrParentJobFailed    = JobError{"parent job failed"}
	ErrQueJobProcessed    = JobError{"que job already processed"}
)

Functions

func CheckJobCompleteAndCleanup

func CheckJobCompleteAndCleanup(ctx context.Context, r repository.Repository, jobID uint) (jobCompleted bool, err error)

func CloseOrLogError

func CloseOrLogError(logger logrus.FieldLogger, f *os.File)

func CreateDir

func CreateDir(path string) error

Types

type JobError

type JobError struct {
	ErrorString string
}

func (JobError) Error

func (je JobError) Error() string

type MockWorker

type MockWorker struct {
	mock.Mock
}

MockWorker is an autogenerated mock type for the Worker type

func NewMockWorker

func NewMockWorker(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockWorker

NewMockWorker creates a new instance of MockWorker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockWorker) EXPECT

func (_m *MockWorker) EXPECT() *MockWorker_Expecter

func (*MockWorker) ProcessJob

func (_mock *MockWorker) ProcessJob(ctx context.Context, queJobID int64, job models.Job, jobArgs worker_types.JobEnqueueArgs) error

ProcessJob provides a mock function for the type MockWorker

func (*MockWorker) ValidateJob

func (_mock *MockWorker) ValidateJob(ctx context.Context, queJobID int64, jobArgs worker_types.JobEnqueueArgs) (*models.Job, error)

ValidateJob provides a mock function for the type MockWorker

type MockWorker_Expecter

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

func (*MockWorker_Expecter) ProcessJob

func (_e *MockWorker_Expecter) ProcessJob(ctx any, queJobID any, job any, jobArgs any) *MockWorker_ProcessJob_Call

ProcessJob is a helper method to define mock.On call

  • ctx context.Context
  • queJobID int64
  • job models.Job
  • jobArgs worker_types.JobEnqueueArgs

func (*MockWorker_Expecter) ValidateJob

func (_e *MockWorker_Expecter) ValidateJob(ctx any, queJobID any, jobArgs any) *MockWorker_ValidateJob_Call

ValidateJob is a helper method to define mock.On call

  • ctx context.Context
  • queJobID int64
  • jobArgs worker_types.JobEnqueueArgs

type MockWorker_ProcessJob_Call

type MockWorker_ProcessJob_Call struct {
	*mock.Call
}

MockWorker_ProcessJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessJob'

func (*MockWorker_ProcessJob_Call) Return

func (*MockWorker_ProcessJob_Call) Run

func (*MockWorker_ProcessJob_Call) RunAndReturn

func (_c *MockWorker_ProcessJob_Call) RunAndReturn(run func(ctx context.Context, queJobID int64, job models.Job, jobArgs worker_types.JobEnqueueArgs) error) *MockWorker_ProcessJob_Call

type MockWorker_ValidateJob_Call

type MockWorker_ValidateJob_Call struct {
	*mock.Call
}

MockWorker_ValidateJob_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateJob'

func (*MockWorker_ValidateJob_Call) Return

func (*MockWorker_ValidateJob_Call) Run

func (*MockWorker_ValidateJob_Call) RunAndReturn

type Worker

type Worker interface {
	ValidateJob(ctx context.Context, queJobID int64, jobArgs worker_types.JobEnqueueArgs) (*models.Job, error)
	ProcessJob(ctx context.Context, queJobID int64, job models.Job, jobArgs worker_types.JobEnqueueArgs) error
}

func NewWorker

func NewWorker(db *sql.DB) Worker

Jump to

Keyboard shortcuts

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