handler

package
v0.0.0-...-9b25803 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Director      = Target("director")
	HealthMonitor = Target("hm")
)
View Source
const (
	Heartbeat = Topic("heartbeat")
	Alert     = Topic("alert")
	Shutdown  = Topic("shutdown")
)
View Source
const (
	UnlimitedResponseLength = -1
)

Variables

This section is empty.

Functions

func BuildErrorWithJSON

func BuildErrorWithJSON(msg string, logger boshlog.Logger) ([]byte, error)

Types

type Func

type Func func(req Request) (resp Response)

type Handler

type Handler interface {
	Run(handlerFunc Func) error
	Start(handlerFunc Func) error
	Stop()

	RegisterAdditionalFunc(handlerFunc Func)

	Send(target Target, topic Topic, message interface{}) error
}

type Request

type Request struct {
	ReplyTo string `json:"reply_to"`
	Method  string
	Payload []byte
}

func NewRequest

func NewRequest(replyTo, method string, payload []byte) Request

func PerformHandlerWithJSON

func PerformHandlerWithJSON(rawJSON []byte, handler Func, maxResponseLength int, logger boshlog.Logger) ([]byte, Request, error)

func (Request) GetPayload

func (r Request) GetPayload() []byte

type Response

type Response interface {
	// Shorten attempts to return a response
	// that can be serialized in a smaller size.
	Shorten() Response
}

func NewExceptionResponse

func NewExceptionResponse(err error) (resp Response)

func NewValueResponse

func NewValueResponse(value interface{}) Response

type Target

type Target string

type Topic

type Topic string

Jump to

Keyboard shortcuts

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