job

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 4

README

job

-- import "gopkg.in/Clever/gearman.v2/job"

Usage

type Job
type Job struct {
}

Job represents a Gearman job

func New
func New(handle string, data, warnings io.WriteCloser, packets chan *packet.Packet) *Job

New creates a new Gearman job with the specified handle, updating the job based on the packets in the packets channel. The only packets coming down packets should be packets for this job. It also takes in two WriteClosers to right job data and warnings to.

func (Job) Handle
func (j Job) Handle() string

Handle returns job handle

func (*Job) Run
func (j *Job) Run() State

Run blocks until the job completes. Returns the state, Completed or Failed.

func (Job) Status
func (j Job) Status() Status

Status returns the current status of the gearman job

type State
type State int

State of a Gearman job

const (
	// Unknown is the default 'State' that should not be encountered
	Unknown State = iota
	// Running means that the job has not yet finished
	Running
	// Completed means that the job finished successfully
	Completed
	// Failed means that the job failed
	Failed
)
func (State) String
func (s State) String() string

String implements the fmt.Stringer interface for easy printing.

type Status
type Status struct {
	// Numerator is the numerator of the % complete
	Numerator int
	// Denominator is the denominator of the % complete
	Denominator int
}

Status of a Gearman job

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

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

Job represents a Gearman job

func New

func New(handle string, data, warnings io.WriteCloser, packets chan *packet.Packet) *Job

New creates a new Gearman job with the specified handle, updating the job based on the packets in the packets channel. The only packets coming down packets should be packets for this job. It also takes in two WriteClosers to right job data and warnings to.

func (Job) Handle

func (j Job) Handle() string

Handle returns job handle

func (*Job) Run

func (j *Job) Run() State

Run blocks until the job completes. Returns the state, Completed or Failed.

func (Job) Status

func (j Job) Status() Status

Status returns the current status of the gearman job

type State

type State int

State of a Gearman job

const (
	// Unknown is the default 'State' that should not be encountered
	Unknown State = iota
	// Running means that the job has not yet finished
	Running
	// Completed means that the job finished successfully
	Completed
	// Failed means that the job failed
	Failed
)

func (State) String added in v2.0.2

func (s State) String() string

String implements the fmt.Stringer interface for easy printing.

type Status

type Status struct {
	// Numerator is the numerator of the % complete
	Numerator int
	// Denominator is the denominator of the % complete
	Denominator int
}

Status of a Gearman job

Jump to

Keyboard shortcuts

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