router

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundRoute    = errors.New("not found route")
	ErrNotFoundEndpoint = errors.New("not found endpoint")
)

Functions

This section is empty.

Types

type Endpoint

type Endpoint = endpoint.Endpoint

type Route

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

func (*Route) FindEndpoint

func (r *Route) FindEndpoint(insID string) (*Endpoint, error)

FindEndpoint 查询路由服务端口

func (*Route) Stateful

func (r *Route) Stateful() bool

Stateful 是否有状态

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) AddService

func (r *Router) AddService(service *registry.ServiceInstance) error

AddService 添加服务实例

func (*Router) FindGateEndpoint

func (r *Router) FindGateEndpoint(insID string) (*Endpoint, error)

FindGateEndpoint 查找网关服务端口

func (*Router) FindNodeEndpoint

func (r *Router) FindNodeEndpoint(insID string) (*Endpoint, error)

FindNodeEndpoint 查找节点服务端口

func (*Router) FindNodeRoute

func (r *Router) FindNodeRoute(routeID int32) (*Route, error)

FindNodeRoute 查找节点路由

func (*Router) RangeGateEndpoint

func (r *Router) RangeGateEndpoint(fn func(insID string, ep *Endpoint) bool)

RangeGateEndpoint 轮询网关服务端口

func (*Router) RangeNodeEndpoint

func (r *Router) RangeNodeEndpoint(fn func(insID string, ep *Endpoint) bool)

RangeNodeEndpoint 轮询网关服务端口

func (*Router) RemoveService

func (r *Router) RemoveService(service *registry.ServiceInstance)

RemoveService 移除服务实例

func (*Router) ReplaceServices

func (r *Router) ReplaceServices(services ...*registry.ServiceInstance)

ReplaceServices 替换服务实例

Jump to

Keyboard shortcuts

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