balancer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

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

Balancer is a simple cockroachdb load balancer with automatic node detection.

func New

func New(user, certdir string, logging bool, initialNodes ...string) *Balancer

New creates a new Balancer

func (*Balancer) ChooseNode

func (b *Balancer) ChooseNode() string

ChooseNode returns an active database node while doing simple round robin load balancing.

func (*Balancer) GetAddr

func (b *Balancer) GetAddr() string

GetAddr returns the listener address

func (*Balancer) GetLiveNodes

func (b *Balancer) GetLiveNodes() []string

GetLiveNodes returns the current live node list.

func (*Balancer) GetNodeCount added in v0.1.2

func (b *Balancer) GetNodeCount() int

GetNodeCount returns the current live node count.

func (*Balancer) Listen

func (b *Balancer) Listen(port int)

Listen starts the loadbalancer

func (*Balancer) WaitReady

func (b *Balancer) WaitReady()

WaitReady blocks until Listen is ready

Jump to

Keyboard shortcuts

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