dispatcher

package
v0.0.0-...-c1e5b24 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceStrategy

type BalanceStrategy string
const (
	Random           BalanceStrategy = "random" // 随机
	RoundRobin       BalanceStrategy = "rr"     // 轮询
	WeightRoundRobin BalanceStrategy = "wrr"    // 加权轮询
)

type Dispatcher

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

func NewDispatcher

func NewDispatcher(strategy BalanceStrategy) *Dispatcher

func (*Dispatcher) FindEndpoint

func (d *Dispatcher) FindEndpoint(insID string) (*endpoint.Endpoint, error)

FindEndpoint 查找服务端口

func (*Dispatcher) FindEvent

func (d *Dispatcher) FindEvent(event cluster.Event) (*Event, error)

FindEvent 查找节点事件

func (*Dispatcher) FindRoute

func (d *Dispatcher) FindRoute(route int32) (*Route, error)

FindRoute 查找节点路由

func (*Dispatcher) IterateEndpoint

func (d *Dispatcher) IterateEndpoint(fn func(insID string, ep *endpoint.Endpoint) bool)

IterateEndpoint 迭代服务端口

func (*Dispatcher) ReplaceServices

func (d *Dispatcher) ReplaceServices(services ...*registry.ServiceInstance)

ReplaceServices 替换服务

type Event

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

func (*Event) Event

func (e *Event) Event() cluster.Event

Event 获取事件

func (*Event) FindEndpoint

func (a *Event) FindEndpoint(insID ...string) (*endpoint.Endpoint, error)

FindEndpoint 查询路由服务端点

func (*Event) IterateEndpoint

func (a *Event) IterateEndpoint(fn func(insID string, ep *endpoint.Endpoint) bool)

IterateEndpoint 迭代服务端口

type Route

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

func (*Route) FindEndpoint

func (a *Route) FindEndpoint(insID ...string) (*endpoint.Endpoint, error)

FindEndpoint 查询路由服务端点

func (*Route) Group

func (r *Route) Group() string

Group 路由所属组

func (*Route) ID

func (r *Route) ID() int32

ID 获取路由ID

func (*Route) IterateEndpoint

func (a *Route) IterateEndpoint(fn func(insID string, ep *endpoint.Endpoint) bool)

IterateEndpoint 迭代服务端口

func (*Route) Stateful

func (r *Route) Stateful() bool

Stateful 获取路由状态

Jump to

Keyboard shortcuts

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