client

package
v0.0.0-...-8a04a08 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEncoder                = json.NewEncoder()
	DefaultTimeout                = 1000
	DefaultMaxConcurrentRequests  = 0
	DefaultRequestVolumeThreshold = 5
	DefaultSleepWindow            = 1000
	DefaultErrorPercentThreshold  = 50
)

Functions

This section is empty.

Types

type AsyncRequest

type AsyncRequest struct {
	Service  string
	Method   string
	Request  interface{}
	Response interface{}
	Metadata map[string]string
}

type AsyncResponse

type AsyncResponse struct {
	Status int
	Error  error
}

type CircuitBrakerConfig

type CircuitBrakerConfig struct {
	Timeout                int
	MaxConcurrentRequests  int
	RequestVolumeThreshold int
	SleepWindow            int
	ErrorPercentThreshold  int
}

type Client

type Client interface {
	Publish(topic string, v interface{}, meta map[string]string) error
	AsyncRequests(as []AsyncRequest) []AsyncResponse
	Request(service, method string, reqv interface{}, respv interface{}, header map[string]string) (int, error)
	Close()
}

func New

func New(url string, opts ...Option) (Client, error)

func NewWithRegistry

func NewWithRegistry(r registry.Registry, watch bool, opts ...Option) (Client, error)

type DefaultClient

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

func (*DefaultClient) AsyncRequests

func (c *DefaultClient) AsyncRequests(as []AsyncRequest) []AsyncResponse

func (*DefaultClient) Close

func (c *DefaultClient) Close()

func (*DefaultClient) Publish

func (c *DefaultClient) Publish(topic string, v interface{}, meta map[string]string) error

func (*DefaultClient) Request

func (c *DefaultClient) Request(service, method string, reqv interface{}, respv interface{}, header map[string]string) (int, error)

type Direct

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

func (*Direct) GetAddress

func (d *Direct) GetAddress(service, method string) (string, error)

type Discovery

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

func (*Discovery) GetAddress

func (d *Discovery) GetAddress(service, method string) (string, error)

type HeaderFunc

type HeaderFunc func(header http.Header)

type Method

type Method interface {
	GetAddress(service, method string) (string, error)
}

type Option

type Option func(o *option)

func Broker

func Broker(b broker.Broker) Option

func Encoder

func Encoder(enc encoder.Encoder) Option

func ErrCircuitOpen

func ErrCircuitOpen(s string) Option

func ErrMaxConcurrency

func ErrMaxConcurrency(s string) Option

func ErrTimeout

func ErrTimeout(s string) Option

func ErrorPercentThreshold

func ErrorPercentThreshold(n int) Option
func Header(hdr map[string]string) Option

func MaxConcurrentRequests

func MaxConcurrentRequests(n int) Option

func RequestVolumeThreshold

func RequestVolumeThreshold(n int) Option

func SleepWindow

func SleepWindow(n int) Option

func TLSConfig

func TLSConfig(config *tls.Config) Option

func Timeout

func Timeout(n int) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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