director

package
v0.0.0-...-7cb0e1f Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLLECT_CHECK_STATS_INTERVAL = time.Duration(5 * time.Second)
	UNTAGGED_MEMBER_MAP_ENTRY    = "!UNTAGGED!"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Director

type Director struct {
	MemberID         string
	Config           *config.Config
	Log              log.FieldLogger
	State            bool
	StateChan        <-chan bool
	DistributeChan   <-chan bool
	OverwatchChan    chan<- *overwatch.Message
	StateLock        *sync.Mutex
	DalClient        dal.IDal
	CheckStatsLooper looper.Looper

	CheckStats      map[string]*dal.MemberStat
	CheckStatsMutex *sync.Mutex

	base.Component
}

func New

func New(cfg *config.Config, stateChan <-chan bool, distributeChan <-chan bool, overwatchChan chan<- *overwatch.Message) (*Director, error)

func (*Director) PickNextMember

func (d *Director) PickNextMember(checkTag string) (string, error)

Return the least taxed cluster member

If check stats are blank; return our own memberid:

  • if the check tag is blank and we have no tags
  • if the check tag is the same as one of our own tags
  • else, return a "no feasible members found" error

If check stats are not blank:

  • build a 'feasible members' slice
  • determine if any of the feasible members have the 'checkTag'
  • if not, return a "no feasible members found" error

func (*Director) Start

func (d *Director) Start() error

func (*Director) Stop

func (d *Director) Stop() error

type IDirector

type IDirector interface {
	Start() error
}

Jump to

Keyboard shortcuts

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