registry

package
v0.0.0-...-ba87f1b Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsulDiscovery

func NewConsulDiscovery(c *conf.ConsulConfig) registry.Discovery

NewConsulDiscovery 创建 Consul 服务发现客户端

func NewConsulRegistrar

func NewConsulRegistrar(c *conf.ConsulConfig) registry.Registrar

NewConsulRegistrar 创建 Consul 注册中心客户端 Deprecated: 使用 NewConsulRegistry 替代

func NewConsulRegistry

func NewConsulRegistry(c *conf.ConsulConfig) registry.Registrar

NewConsulRegistry 创建 Consul 统一注册中心客户端(支持注册和发现)

func NewEtcdClient

func NewEtcdClient(cfg *conf.EtcdConfig) (*clientv3.Client, error)

NewEtcdClient 从配置创建 etcd 客户端

func NewEtcdDiscovery

func NewEtcdDiscovery(cfg *conf.EtcdConfig, opts ...Option) (registry.Discovery, error)

NewEtcdDiscovery 从配置创建 etcd 服务发现

func NewEtcdRegistry

func NewEtcdRegistry(cfg *conf.EtcdConfig, opts ...Option) (registry.Registrar, error)

NewEtcdRegistry 从配置创建 etcd 注册中心

func NewNacosDiscovery

func NewNacosDiscovery(c *conf.NacosConfig) registry.Discovery

NewNacosDiscovery 创建 Nacos 服务发现客户端

func NewNacosRegistrar

func NewNacosRegistrar(c *conf.NacosConfig) registry.Registrar

NewNacosRegistrar 创建 Nacos 注册中心客户端 Deprecated: 使用 NewNacosRegistry 替代

func NewNacosRegistry

func NewNacosRegistry(c *conf.NacosConfig) registry.Registrar

NewNacosRegistry 创建 Nacos 统一注册中心客户端(支持注册和发现)

Types

type Option

type Option func(o *options)

Option is etcd registry option.

func Context

func Context(ctx context.Context) Option

Context with registry context.

func MaxRetry

func MaxRetry(num int) Option

func Namespace

func Namespace(ns string) Option

Namespace with registry namespace.

func RegisterTTL

func RegisterTTL(ttl time.Duration) Option

RegisterTTL with register ttl.

type Registry

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

Registry is etcd registry.

func New

func New(client *clientv3.Client, opts ...Option) (r *Registry)

New creates etcd registry

func (*Registry) Deregister

func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInstance) error

Deregister the registration.

func (*Registry) GetService

func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error)

GetService return the service instances in memory according to the service name.

func (*Registry) Register

func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) error

Register the registration.

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)

Watch creates a watcher according to the service name.

Jump to

Keyboard shortcuts

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