selector

package
v0.0.2-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	Do([]registry.Node) []registry.Node
}

type Next

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

return addr, error

type Option

type Option func(*Options)

func Filters

func Filters(f ...Filter) Option

func Getter

func Getter(r registry.Getter) Option

func Strategies

func Strategies(s ...Strategy) Option

type Options

type Options struct {
	Getter     registry.Getter
	Filters    []Filter
	Strategies []Strategy
	// contains filtered or unexported fields
}

type SelectOption

type SelectOption func(*SelectOptions)

func Endpoint

func Endpoint(s string) SelectOption

func Key

func Key(s string) SelectOption

func StrategyName

func StrategyName(s string) SelectOption

type SelectOptions

type SelectOptions struct {
	// strategy used
	Strategy string

	// endpoint name
	Name string

	// key for select
	Key string
}

type Selector

type Selector interface {
	Init(...Option)
	Options() Options
	Select(...SelectOption) (Next, error)
	SelectA(...SelectOption) (registry.Node, error)

	// Mark a node error/success
	Mark(registry.Node, error)
	String() string
}

type Strategy

type Strategy interface {
	Do([]registry.Node, ...SelectOption) Next
	DoA([]registry.Node, ...SelectOption) registry.Node
	Mark(string, registry.Node, error)
	String() string
}

Jump to

Keyboard shortcuts

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