balancer

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 10 Imported by: 0

README

balancer

TODO


Copyright (c) 2022 Archivage Numérique

Documentation

Overview

Package balancer TODO

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 (c *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