Skip to content

Latest commit

 

History

History

runner

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

runner

import "github.com/ardanlabs/kit/runner"

Package runner provide support for writing tasks that must complete within a certain duration or they must be killed. It also provides support for notifying the task the shutdown using a C.

runner.go

var (
    ErrTimeout  = errors.New("Timeout")
    ErrSignaled = errors.New("Signaled")
)

Error variables for the different states.

type Jobber interface {
    Job(traceID string) error
}

Jobber defines an interface for providing the implementation details for processing a user job.

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

Runner maintains state for the running process.

func New(timeout time.Duration) *Runner

New returns a new Runner value for use.

func (r *Runner) CheckShutdown() bool

CheckShutdown can be used to check if a shutdown request has been issued.

func (*Runner) Run

func (r *Runner) Run(traceID string, job Jobber) error

Run performs the execution of the specified job.


Generated by godoc2md