provider

package
v0.0.0-...-eaa370e Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2015 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Factories           = make(map[string]ProviderFactory)
	WRONG_CONFIG_TYPE   = errors.New("provider: wrong config type")
	PROVIDER_NOT_EXIST  = errors.New("provider: provider type does not exist")
	BAD_PROVIDER_CONFIG = errors.New("provider: bad config for provider")
)

Functions

func LoadProvider

func LoadProvider(p ProviderFactory)

LoadProvider loads a provider factory

Types

type Provider

type Provider interface {
	// RequestWork tell the provider you are ready for new work
	RequestWork(int, chan job.Job) error
	// a provider must be able to confirm jobs as well
	job.JobConfirmer
	// WaitTime tells the manager how long to wait before checking for more work
	// target is given in terms of jobs per second
	WaitTime(target float64) time.Duration
	// Close tells the provider to gracefully close all of it's connections to the outside world
	Close() error
	Target() float64

	config.Configer

	Name() string
}

Provider requests work from a datasource, and passes it to the manager

func Create

func Create(name string, c config.Config) (Provider, error)

Create given a config, create, initilize and return a new prover

type ProviderFactory

type ProviderFactory func() Provider

ProviderFactory build and return a new provider

Directories

Path Synopsis
Package http provider allows for jobs to be manualy inserted into the manager though an http api.
Package http provider allows for jobs to be manualy inserted into the manager though an http api.
Package redis contains a provider which supplies the manager with jobs stored in a redis list.
Package redis contains a provider which supplies the manager with jobs stored in a redis list.

Jump to

Keyboard shortcuts

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