lb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetAdded   = "Added"
	TargetRemoved = "Removed"
	LbStopped     = "LbStopped"
)

Variables

View Source
var (
	DownErr   = errors.New("lb down")
	PausedErr = errors.New("lb paused")
)

Functions

This section is empty.

Types

type KeyLbNotifier

type KeyLbNotifier interface {
	KeyLoadBalancer
	LbNotifier
}

func NewEtcdLoadBalancer

func NewEtcdLoadBalancer(ctx context.Context, cli *clientv3.Client, path string, myTarget string, opts ...Option) (KeyLbNotifier, error)

type KeyLoadBalancer

type KeyLoadBalancer interface {
	Target(key string, waitSettleTime bool) (string, error)
	Close()
}

func NewStaticLB

func NewStaticLB(mykey string, allKeys []string) KeyLoadBalancer

func NewStaticLbFromIndexes

func NewStaticLbFromIndexes(prefix string, myIndex, all int) KeyLoadBalancer

type LbEvent

type LbEvent struct {
	CreatedOn time.Time
	Event     string
	Target    string
}

func NewAddedEvent

func NewAddedEvent(target string) *LbEvent

func NewLbStoppedEvent

func NewLbStoppedEvent() *LbEvent

func NewRemovedEvent

func NewRemovedEvent(target string) *LbEvent

type LbNotifier

type LbNotifier interface {
	Notify() <-chan *LbEvent
	NotifyBulk() <-chan []*LbEvent
}

type Option

type Option func(config *optionalConfig)

func WithSetleTime

func WithSetleTime(d time.Duration) Option

func WithSubPath

func WithSubPath(subPath string) Option

Jump to

Keyboard shortcuts

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