plugin

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = func() *Options {
	return &Options{
		Selector: &selector.Options{
			SelectorName:    "consul",
			Address:         "127.0.0.1:8500",
			EnableHeartbeat: true,
			Scheme:          "http",
			HeartbeatOptions: &selector.HeartbeatOptions{
				Port:                           "8001",
				Timeout:                        "5s",
				Interval:                       "5s",
				DeregisterCriticalServiceAfter: "20s",
			},
		},
		Balancer: &balance.Options{
			BalancerName: balance.WeightPoll,
		},
	}
}
View Source
var New = func(opts *Options) *Factory {
	return &Factory{
		options: opts,
	}
}

Functions

This section is empty.

Types

type Factory

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

func (*Factory) GetBalancer

func (f *Factory) GetBalancer() balance.Balancer

GetBalancer 获取负载均衡插件.

func (*Factory) GetSelector

func (f *Factory) GetSelector() selector.Selector

GetSelector 获取服务发现插件.

func (*Factory) Setup

func (f *Factory) Setup(opts ...Option) error

Setup 加载插件工厂中的插件.

type Option

type Option func(*Options)

func WithBalancerName

func WithBalancerName(name string) Option

func WithHeartbeatInterval

func WithHeartbeatInterval(interval string) Option

func WithHeartbeatPort

func WithHeartbeatPort(port string) Option

func WithHeartbeatTimeout

func WithHeartbeatTimeout(timeout string) Option

func WithSelectorAddress

func WithSelectorAddress(address string) Option

func WithSelectorDeregisterCriticalServiceAfter

func WithSelectorDeregisterCriticalServiceAfter(t string) Option

func WithSelectorEnableHeartbeat

func WithSelectorEnableHeartbeat(b bool) Option

func WithSelectorName

func WithSelectorName(name string) Option

func WithSelectorScheme

func WithSelectorScheme(scheme string) Option

type Options

type Options struct {
	Selector *selector.Options `yaml:"selector"`
	Balancer *balance.Options  `yaml:"balancer"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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