package
0.0.0-20170928162525-58fa5b2d0b1e
Repository: https://github.com/ardanlabs/kit.git
Documentation: pkg.go.dev

# README

runner

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

Overview

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.

Index

Package files

runner.go

Variables

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

Error variables for the different states.

type Jobber

type Jobber interface {
    Job(traceID string) error
}

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

type Runner

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

Runner maintains state for the running process.

func New

func New(timeout time.Duration) *Runner

New returns a new Runner value for use.

func (*Runner) CheckShutdown

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

# Functions

New returns a new Runner value for use.

# Variables

Error variables for the different states.
Error variables for the different states.

# Structs

Runner maintains state for the running process.

# Interfaces

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