selector

package
v0.0.0-...-82b0641 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrNoneAvailable = errors.New("none available")
)

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func BalanceStrategy

func BalanceStrategy(fn Strategy) Option

func Filter

func Filter(fn ...registry.Filter) Option

type Options

type Options struct {
	Strategy Strategy
	Filters  []registry.Filter

	Context context.Context
}

type Selector

type Selector interface {
	Options() Options
	Next(service string) (*registry.Node, error)
	Close() error
	String() string
}

type Strategy

type Strategy func([]*registry.Service) (*registry.Node, error)

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

func Random

func Random() Strategy

Random is a random strategy algorithm for node selection

func RoundRobin

func RoundRobin() Strategy

RoundRobin is a round robin strategy algorithm for node selection

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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