http

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: 8 Imported by: 0

Documentation

Overview

Package http provider allows for jobs to be manualy inserted into the manager though an http api. This provider can be enabled though the config file, just as any other provider. However, the manager will not pull this provider for jobs.

Index

Constants

View Source
const (
	DEFAULT_ENDPOINT = "/job/add"
)

Variables

View Source
var (
	STATUS_TO_HTTP_CODE = map[job.Status]uint{
		job.STATUS_SUCCESS: std_http.StatusOK,
		job.STATUS_FAILURE: std_http.StatusInternalServerError,
	}

	NOT_HTTP_JOB = errors.New("This job is not of the correct type. Expecting type *HttpJob")
)

Functions

func HttpFactory

func HttpFactory() provider.Provider

HttpFactory factory for new http request

Types

type Http

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

Http is a provider that allows for manual insertion of jobs

func (*Http) Close

func (h *Http) Close() error

Close

func (*Http) ConfigStruct

func (h *Http) ConfigStruct() interface{}

func (*Http) ConfirmJob

func (h *Http) ConfirmJob(j job.Job) error

ConfirmJob

func (*Http) Init

func (h *Http) Init(i interface{}) error

Init init a http provider and start it's webserver

func (*Http) Name

func (h *Http) Name() string

Name return the name of the provider

func (*Http) RequestWork

func (h *Http) RequestWork(n int, c chan job.Job) error

RequestWork register a new handler function. Then hold the provider open for ever.

func (*Http) Target

func (h *Http) Target() float64

Target return 0.0 as this provider can not be limited

func (*Http) WaitTime

func (h *Http) WaitTime(t float64) time.Duration

WaitTime

type HttpConfig

type HttpConfig struct {
	ListOn   string `json:"listen_on"`
	Endpoint string `json:"endpoint"`
}

HttpConfig provides config information for the Http provider

type HttpJob

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

HttpJob is a job created by the http provider

func (*HttpJob) Config

func (h *HttpJob) Config() *job.JobConfig

config return the JobConfig for this job

func (*HttpJob) JobConfirmer

func (h *HttpJob) JobConfirmer() job.JobConfirmer

JobConfirmer return this job's provider

Jump to

Keyboard shortcuts

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