job

package module
v0.0.0-...-e7d0e91 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2014 License: MIT Imports: 3 Imported by: 0

README

job

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Work

func Work(jobs <-chan interface{}, options *Options) <-chan interface{}

Types

type Clock

type Clock struct {
	C <-chan interface{}
	// contains filtered or unexported fields
}

Clock sends the value given to the Send function after the delay specified in NewClock. Sending another value will restart the timer.

func NewClock

func NewClock(d time.Duration) *Clock

NewClock constructs a new Clock with the given delay. Call Close to stop the clock's goroutine.

func (*Clock) Close

func (c *Clock) Close()

Close stops the timer. Close will panic if Close has already been called.

func (*Clock) Send

func (c *Clock) Send(v interface{})

Send restarts the timer with the new value. Start will panic if Close has been called.

type Options

type Options struct {
	Work       func(interface{}) interface{}
	NumWorkers int // default 1
	MaxWaiting int // default 10
}

Jump to

Keyboard shortcuts

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