balancer

package module
v0.0.0-...-6069a25 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 10 Imported by: 1

README

balancer

AFAIRE


Copyright (c) 2022-2023 Archivage Numérique

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	Next() []*Endpoint
}

type Config

type Config struct {
	CertFile  string            `dm:"cert_file"`
	KeyFile   string            `dm:"key_file"`
	Endpoints []*EndpointConfig `dm:"endpoints"`
}

func (*Config) NewEndpoints

func (cfg *Config) NewEndpoints(fn breaker.OnStateChangeFunc) (*Endpoints, error)

type Endpoint

type Endpoint struct {
	URL      string
	Username string
	Password string
	Client   *http.Client
	// contains filtered or unexported fields
}

func (*Endpoint) Update

func (e *Endpoint) Update(success bool)

func (*Endpoint) Usable

func (e *Endpoint) Usable() bool

type EndpointConfig

type EndpointConfig struct {
	Breaker  breaker.Config `dm:"breaker"`
	URL      string         `dm:"url"`
	Username string         `dm:"username"`
	Password string         `dm:"password"`
	CAFile   string         `dm:"ca_file"`
}

type Endpoints

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

func (*Endpoints) List

func (es *Endpoints) List() []*Endpoint

func (*Endpoints) RoundRobin

func (es *Endpoints) RoundRobin() Balancer

Jump to

Keyboard shortcuts

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