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 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址