pool

package
v0.0.0-...-5e277a7 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthCheck

func HealthCheck()

HealthCheck runs a routine for check status of the backends every 2 mins

Types

type ServerPool

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

ServerPool struct that holds the backends and the current backend index

var Pool ServerPool

Pool is the global ServerPool

func (*ServerPool) AddBackend

func (s *ServerPool) AddBackend(backend *backend.Backend)

AddBackend adds a new backend to the server pool

func (*ServerPool) GetNextBackend

func (s *ServerPool) GetNextBackend() *backend.Backend

GetNextBackend returns the next active backend that will receive the connection

func (*ServerPool) HealthCheck

func (s *ServerPool) HealthCheck()

HealthCheck pings the backends and update the status

func (*ServerPool) MarkBackendStatus

func (s *ServerPool) MarkBackendStatus(backendURL *url.URL, alive bool)

MarkBackendStatus changes the status of a backend

func (*ServerPool) NextBackendIndex

func (s *ServerPool) NextBackendIndex() int

NextBackendIndex increments atomically the counter and returns the next backend index

Jump to

Keyboard shortcuts

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