runner

package
v0.0.0-...-58fa5b2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 5 Imported by: 9

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

Documentation

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 <control> C.

Index

Constants

This section is empty.

Variables

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

Error variables for the different states.

Functions

This section is empty.

Types

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.

Jump to

Keyboard shortcuts

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