selector

package
v0.0.0-...-45c970c Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock return items one by one

func (*Clock) Add

func (clock *Clock) Add(weight int32, client resolver.DNSClient)

Add item to list

func (*Clock) Empty

func (clock *Clock) Empty() bool

Empty Selector?

func (*Clock) Get

func (clock *Clock) Get() *Item

Get an item

func (*Clock) Name

func (clock *Clock) Name() string

Name of selector

func (*Clock) SetHealth

func (clock *Clock) SetHealth(item *Item, score int32)

SetHealth of an item

func (*Clock) Start

func (clock *Clock) Start()

Start set index

type Item

type Item struct {
	Client *resolver.DNSClient
	// contains filtered or unexported fields
}

Item is an item in Selector

type Random

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

Random return items randomally

func (*Random) Add

func (random *Random) Add(weight int32, client resolver.DNSClient)

Add item to list

func (*Random) Empty

func (random *Random) Empty() bool

Empty Selector?

func (*Random) Get

func (random *Random) Get() *Item

Get an item

func (*Random) Name

func (random *Random) Name() string

Name of selector

func (*Random) SetHealth

func (random *Random) SetHealth(item *Item, score int32)

SetHealth of an item

func (*Random) Start

func (random *Random) Start()

Start set index

type SWrr

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

SWrr implemented smooth weighted round robin

func (*SWrr) Add

func (sWrr *SWrr) Add(weight int32, client resolver.DNSClient)

Add item to list

func (*SWrr) Empty

func (sWrr *SWrr) Empty() bool

Empty Selector?

func (*SWrr) Get

func (sWrr *SWrr) Get() *Item

Get an item

func (*SWrr) Name

func (sWrr *SWrr) Name() string

Name of selector

func (*SWrr) SetHealth

func (sWrr *SWrr) SetHealth(item *Item, score int32)

SetHealth of an item

func (*SWrr) Start

func (sWrr *SWrr) Start()

Start set index

type Selector

type Selector interface {
	Name() string
	Add(weight int32, client resolver.DNSClient)
	Empty() bool
	Start()
	Get() *Item
	SetHealth(item *Item, score int32)
}

Selector implemented round robins

type WRandom

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

WRandom return items randomally with weight

func (*WRandom) Add

func (wRandom *WRandom) Add(weight int32, client resolver.DNSClient)

Add item to list

func (*WRandom) Empty

func (wRandom *WRandom) Empty() bool

Empty Selector?

func (*WRandom) Get

func (wRandom *WRandom) Get() *Item

Get an item

func (*WRandom) Name

func (wRandom *WRandom) Name() string

Name of selector

func (*WRandom) SetHealth

func (wRandom *WRandom) SetHealth(item *Item, score int32)

SetHealth of an item

func (*WRandom) Start

func (wRandom *WRandom) Start()

Start set index

Jump to

Keyboard shortcuts

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