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
Click to show internal directories.
Click to hide internal directories.