registry

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNotFound = errors.New("config not found")
View Source
var ErrRegistry = errors.New("registry error")
View Source
var ErrRegistryOption = errors.New("registry option error")
View Source
var Factories map[Schema]IRegistryFactory

Factories 指定所有支持的注册中心的工厂

Functions

This section is empty.

Types

type EtcdRegistryOptions

type EtcdRegistryOptions struct {
	AppName    string           // AppName 指定应用名称,也会作为 etcd 的注册路径
	Interval   time.Duration    // Interval 指定多久检测并重新续约
	LeaseTTL   int64            // LeaseTTL 租约时长
	Logger     *zap.Logger      // Logger 日志
	EtcdConfig *clientv3.Config // EtcdConfig 指定etcd 配置
}

EtcdRegistryOptions etcd注册中心配置选项

type IRegistry

type IRegistry interface {
	// Register 以应用维度注册一个 endpoint
	Register(addr string, port int, metadata interface{}) error

	// Deregister 以应用维度取消一个endpoint的注册记录
	Deregister(addr string, port int) error
}

IRegistry 接口

type IRegistryFactory

type IRegistryFactory interface {
	// BuildOptions 构建 registry 配置选项
	BuildOptions(cfg *config.ServerConfig) error

	// CreateRegistry 创建 registry
	CreateRegistry() (IRegistry, error)
}

IRegistryFactory registry工厂,用于创建不同的registry

type Schema

type Schema string

Schema 指定registry的协议

const (
	SchemaEtcd Schema = "etcd"
)

Jump to

Keyboard shortcuts

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