weightpool

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool defines sets of weighted tags

func NewPool

func NewPool(routeTags ...*model.RouteTag) *Pool

NewPool returns pool for provided tags

func (*Pool) PickOne

func (p *Pool) PickOne() *model.RouteTag

PickOne returns tag according to its weight

type SafePool

type SafePool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SafePool is a cache for pool of all destination

func GetPool

func GetPool() *SafePool

GetPool returns singleton of weightPool

func (*SafePool) Get

func (s *SafePool) Get(key string) (*Pool, bool)

Get returns specific pool for key

func (*SafePool) Reset

func (s *SafePool) Reset(key string)

Reset can delete pool for specific key

func (*SafePool) Set

func (s *SafePool) Set(key string, value *Pool)

Set can set pool to safe cache

Jump to

Keyboard shortcuts

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