job

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commander

type Commander interface {
	Execute(context.Context) error
}

Commander interface defines the command to be executed

type Job

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

Job is a job that can be run

func NewJob

func NewJob(command Commander) *Job

NewJob creates a new job

func (*Job) Close

func (j *Job) Close()

Close closes the job channels

func (*Job) Done

func (j *Job) Done() <-chan struct{}

Done returns a channel that is closed when the job is done

func (*Job) Err

func (j *Job) Err() <-chan error

Err returns a channel that is closed when the job has an error

func (*Job) Run

func (j *Job) Run(ctx context.Context)

Run runs the job

func (*Job) Wait

func (j *Job) Wait() error

Wait waits for the job to finish

type JobFactory

type JobFactory struct{}

JobFactory is a factory for creating jobs

func NewJobFactory

func NewJobFactory() *JobFactory

NewJobFactory returns a new job factory

func (*JobFactory) New

func (f *JobFactory) New(command Commander) scheduler.Jobber

New returns a new build job constructor

type MockJob

type MockJob struct {
	mock.Mock
}

MockJob is a mock of Jobber interface

func NewMockJob

func NewMockJob() *MockJob

NewMockJob creates a new mock job

func (*MockJob) Close

func (j *MockJob) Close()

Close closes the job channels

func (*MockJob) Done

func (j *MockJob) Done() <-chan struct{}

Done returns a channel that is closed when the job is done

func (*MockJob) Err

func (j *MockJob) Err() <-chan error

Err returns a channel that is closed when the job has an error

func (*MockJob) Run

func (j *MockJob) Run(ctx context.Context)

Run is a mock implementation of Jobber.Run

func (*MockJob) Wait

func (j *MockJob) Wait() error

Wait waits for the job to finish

type MockJobFactory

type MockJobFactory struct {
	mock.Mock
}

MockJobFactory is a factory to create a mock build command

func NewMockJobFactory

func NewMockJobFactory() *MockJobFactory

NewMockJobFactory returns a new mock build command factory

func (*MockJobFactory) New

func (f *MockJobFactory) New(command Commander) scheduler.Jobber

New returns a new build command constructor

Jump to

Keyboard shortcuts

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