registry

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: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry interface {
	// Register 注册服务实例
	Register(ctx context.Context, ins *ServiceInstance) error
	// Deregister 解注册服务实例
	Deregister(ctx context.Context, ins *ServiceInstance) error
	// Watch 监听相同服务名的服务实例变化
	Watch(ctx context.Context, serviceName string) (Watcher, error)
	// Services 获取服务实例列表
	Services(ctx context.Context, serviceName string) ([]*ServiceInstance, error)
}

type Route

type Route struct {
	// 路由ID
	ID int32 `json:"id"`
	// 是否有状态
	Stateful bool `json:"stateful"`
}

type ServiceInstance

type ServiceInstance struct {
	// 服务实体ID,每个服务实体ID唯一
	ID string `json:"id"`
	// 服务实体名
	Name string `json:"name"`
	// 服务实体类型
	Kind cluster.Kind `json:"kind"`
	// 服务实体别名
	Alias string `json:"alias"`
	// 服务实例状态
	State cluster.State `json:"state"`
	// 服务路由ID
	Routes []Route `json:"routes"`
	// 服务器实体暴露端口
	Endpoint string `json:"endpoint"`
}

type Watcher

type Watcher interface {
	// Next 返回服务实例列表
	Next() ([]*ServiceInstance, error)
	// Stop 停止监听
	Stop() error
}

Directories

Path Synopsis
etcd module

Jump to

Keyboard shortcuts

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