agent

package
v0.0.0-...-a08e549 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2015 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnexpectedError describes the error when a job panics
	ErrUnexpectedError = errors.New("Job exited with unexpected error")
)

Functions

func New

func New(config *Config) quantum.Agent

New creates a new Agent with the specified port

Types

type Agent

type Agent struct {
	*quantum.ConnConfig

	quantum.Registry
	// contains filtered or unexported fields
}

Agent routes job requests to jobs, and runs the jobs with the request

func (*Agent) Accept

func (a *Agent) Accept(ln net.Listener) error

Accept accepts on a specified net.Listener

func (*Agent) Close

func (a *Agent) Close() error

Close shutdowns an agent

func (*Agent) IsShutdown

func (a *Agent) IsShutdown() chan struct{}

IsShutdown returns a chan that determines whether we're shutdown

func (*Agent) Start

func (a *Agent) Start() error

Start starts the agent by setting up the signal listener and listening on port.

type Config

type Config struct {
	*quantum.ConnConfig

	Port string

	Registry    quantum.Registry
	Registrator quantum.Registrator
}

Config encapsulates configuration for an agent

type Conn

type Conn struct {
	mux.Server

	// Senders
	OutCh chan string

	// Receivers
	SigCh     chan os.Signal
	RequestCh chan quantum.Request
	// contains filtered or unexported fields
}

Conn wraps a Connection

func NewConn

func NewConn(conn net.Conn, config *quantum.ConnConfig) (*Conn, error)

NewConn returns a new Connection connected to the specified io.ReadWriter

func (*Conn) Lager

func (conn *Conn) Lager() lager.Lager

Lager returns the Lager of the connection, allowing jobs to log to the agent

func (*Conn) Logs

func (conn *Conn) Logs() chan string

Logs returns the logs channel of the connection

func (*Conn) Serve

func (conn *Conn) Serve(reg quantum.Registry)

Serve processes a connection and serves the response

func (*Conn) Signals

func (conn *Conn) Signals() chan os.Signal

Signals returns the signals channel of the connection

type Port

type Port struct {
	Value string
}

Port holds a port in the form :XXXX

func NewPort

func NewPort(s string) Port

NewPort returns a Port

func (Port) Int

func (p Port) Int() int

Int returns a int representation of Port

Jump to

Keyboard shortcuts

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