destination

package
v0.0.0-...-10ab71a Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 4 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[ServersStr]*Setting

Map represents routing map config

type Server

type Server struct {
	HostPort ServerHostPort
	Weight   uint32
}

Server is a single entry in cluster specification

type ServerHostPort

type ServerHostPort string

ServerHostPort is a full host name with port, e.g. "srv1:8123"

type ServersStr

type ServersStr string

ServersStr represent location that accepts logs (e.g. "srv1:8123" or "=srv1*100 =srv2*100 =srv3*100")

type Setting

type Setting struct {
	Default bool
	Servers []Server
	Tables  []string
	// contains filtered or unexported fields
}

Setting represents group of settings for specific destination Server

func NewSetting

func NewSetting() *Setting

NewSetting must be used to initialize Setting struct

func (*Setting) ChooseNextServer

func (s *Setting) ChooseNextServer() (srv ServerHostPort, ok bool)

ChooseNextServer returns next server from the list or ok=false, which means that there are no available hosts

func (*Setting) Destroy

func (s *Setting) Destroy()

Destroy stops health check goroutines, if any

func (*Setting) Init

func (s *Setting) Init()

Init sets up current state based on public settings

func (*Setting) TempDisableHost

func (s *Setting) TempDisableHost(srv ServerHostPort, aliveCheck aliveCheckFunc)

TempDisableHost marks provided host as temporarily disabled (it will not be returned in ChooseNextServer()). Provided callback checkCb is used to periodically check that server went live again.

Jump to

Keyboard shortcuts

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