selector

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Next

type Next func() (*registry.Node, error)

Next is a function that returns the next node based on the selector's strategy

func Random

func Random(services []*registry.Service) Next

Random is a random strategy algorithm for node selection

func RoundRobin

func RoundRobin(services []*registry.Service) Next

RoundRobin is a roundrobin strategy algorithm for node selection

type Option

type Option func(*Options)

Option used to initialise the selector

func SetStrategy

func SetStrategy(fn Strategy) Option

SetStrategy sets the default strategy for the selector

type Options

type Options struct {
	Strategy Strategy
}

type Selector

type Selector interface {
	Init() error
	Select(service, version string) (string, error)
}

func NewSelector

func NewSelector(registry registry.Registry, opts ...Option) Selector

type Strategy

type Strategy func([]*registry.Service) Next

Strategy is a selection strategy e.g random, round robin

Jump to

Keyboard shortcuts

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