lb

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name      string
	Instances []*ServerInstance
	// contains filtered or unexported fields
}

func (*App) Get

func (a *App) Get(key string) *ServerInstance

type Apps

type Apps struct {
	Client *eureka.Client
}

func (*Apps) Get

func (a *Apps) Get(appName string) *App

type Balancer

type Balancer interface {
	Next(key string, hosts []*ServerInstance) *ServerInstance
}

负载均衡器接口

type HashBalancer

type HashBalancer struct {
}

func (*HashBalancer) Next

func (h *HashBalancer) Next(key string, hosts []*ServerInstance) *ServerInstance

type RandomBalancer

type RandomBalancer struct {
}

随机负载均衡算法

func (*RandomBalancer) Next

func (r *RandomBalancer) Next(key string, hosts []*ServerInstance) *ServerInstance

type RoundRobinBalancer

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

简单轮询负载均衡算法

func (*RoundRobinBalancer) Next

func (r *RoundRobinBalancer) Next(key string, hosts []*ServerInstance) *ServerInstance

type ServerInstance

type ServerInstance struct {
	InstanceId string
	AppName    string
	Address    string
	Status     Status
	Metadata   map[string]string
}

服务实例

type Status

type Status string

服务实例的状态

const (
	StatusEnabled  Status = "enabled"
	StatusDisabled Status = "disabled"
)

Jump to

Keyboard shortcuts

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