registry

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RegistryClient

type RegistryClient interface {
	// Register 把本服务注册到配置中心。
	Register(registryConfigData []byte)
	// GetServiceURL v1 单实例返回,保留向后兼容。
	// 内部实现通常从多实例中随机选 1 个返回,与 GetServices 等价。
	GetServiceURL(servicename string, groupName ...string) (string, string)
	// GetServices v2 新增:返回该服务的所有可用实例 URL 列表。
	// 用于客户端负载均衡(pkg/loadbalancer)。
	// 找不到实例时返 (nil, nil),错误时返 (nil, err)。
	GetServices(servicename string, groupName ...string) ([]string, error)
	// DeRegister 注销本服务。
	DeRegister()
}

RegistryClient 是 mgin v2 扩展后的统一注册中心客户端接口。

v1 接口:Register / GetServiceURL / DeRegister(保持不变,存量项目无需改动)。 v2 新增:GetServices 多实例列表,供 client.CallCtx 的负载均衡使用。

var Registry RegistryClient

func NewRegistry

func NewRegistry() RegistryClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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